问:
Getting a "Type mismatch (Error 13)" when Delete data in target column
First off I want to say that I have zero experience with any of this. I just discovered vba two days ago because of my google searches and it led me to this site which has been extremly helpful.

I have a vba code/function(dont know what to call it, sorry) that I used from here and slightly modified to work for what I wanted to do.
Right now it does exactly what I want except for when I clear out the cells that have information in them it gives me an error 13 type mismatch. I don't think there is any way around this but like I said, I know nothing at all about what I am doing.

Here is my current code.

```<code>Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 16 And Target.Value = "Complete" Then
        Target.Offset(0, 1) = Format(Now())
    End If
End Sub
</code>```

In a shared "data tracking sheet" In column 16 I have data validation, select from a list, with a dropdown box to select "Complete". With my current code when I select Complete in the dropdown box it generates the date in the column next to the drop down box. This is all working as intended.

If you were to delete the drop down box selection of "completed" and adjacent column with the date, it gives me the error 13. If I hit end on the error message it goes away and everything functions as it should. This is only a problem if someone were to accidentally mark the wrong box as completed then delete what they have done, but all they have to do is hit end on the error message and it goes away and works properly.

Is there any way around this or will everyone that accesses this data tracking sheet just have to know to hit end if this error message pops up?

I apologize in advance if this is a poorly worded question.

As of now I am not sure what to try to solve this problem, or if it can be solved.

Body:
First off I want to say that I have zero experience with any of this. I just discovered vba two days ago because of my google searches and it led me to this site which has been extremly helpful.

I have a vba code/function(dont know what to call it, sorry) that I used from here and slightly modified to work for what I wanted to do.
Right now it does exactly what I want except for when I clear out the cells that have information in them it gives me an error 13 type mismatch. I don't think there is any way around this but like I said, I know nothing at all about what I am doing.

Here is my current code.

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 16 And Target.Value = "Complete" Then
        Target.Offset(0, 1) = Format(Now())
    End If
End Sub

In a shared "data tracking sheet" In column 16 I have data validation, select from a list, with a dropdown box to select "Complete". With my current code when I select Complete in the dropdown box it generates the date in the column next to the drop down box. This is all working as intended.

If you were to delete the drop down box selection of "completed" and adjacent column with the date, it gives me the error 13. If I hit end on the error message it goes away and everything functions as it should. This is only a problem if someone were to accidentally mark the wrong box as completed then delete what they have done, but all they have to do is hit end on the error message and it goes away and works properly.

Is there any way around this or will everyone that accesses this data tracking sheet just have to know to hit end if this error message pops up?

I apologize in advance if this is a poorly worded question.

As of now I am not sure what to try to solve this problem, or if it can be solved.


来源: stackexchange

问:
Having problem connecting to my Express server from another machine
I am developing a Node.js Chess application with Express.
I can't manage to connect to my Express server im running on my pc with another machine which is connected to the same Wifi network as my pc.

I have tried the following:

listening on the default address , on '0.0.0.0' and on my pc IP address.

listening on different ports, like 3000 and 80.

enabling a port rule in the Firewall.

this is the code in app.js :

```<code>const express = require('express')
const app = express();
app.use(express.static("chess_game"));

app.get('/' , (req , res) => {
   console.log("get request")
   res.sendFile('./chess_game/index.html')
})

app.listen(80 ,'192.168.137.1' ,() =>
console.log("listening..."));
</code>```

Nothing seems to make a difference, any suggestions?

ContentLicense: CC BY-SA 4.0

Body:
I am developing a Node.js Chess application with Express.
I can't manage to connect to my Express server im running on my pc with another machine which is connected to the same Wifi network as my pc.

I have tried the following:

listening on the default address , on '0.0.0.0' and on my pc IP address.

listening on different ports, like 3000 and 80.

enabling a port rule in the Firewall.

this is the code in app.js :

const express = require('express')
const app = express();
app.use(express.static("chess_game"));

app.get('/' , (req , res) => {
   console.log("get request")
   res.sendFile('./chess_game/index.html')
})

app.listen(80 ,'192.168.137.1' ,() =>
console.log("listening..."));

Nothing seems to make a difference, any suggestions?


问:
How to get ecs metadata json response
I have my ecs task running on fargate launch type version 1.4.0 and it is working properly it is using private ECR respository to get the app image. I want to get it's metadata. It has only private IP and i know this link ecs fargate metadata but i am not able to find anywhere this variable ECS_CONTAINER_METADATA_URI_V4
. My question is how to get the json response mentioned in the link above. Also exec is not enabled on this task. Please help

Title: How to get ecs metadata json response


问:
How to add mongodb server to dotnet project installer
I have created an installer for my dotnet project by running dotnet publish -r osx-arm64. However, when I try to run the executeable it looks like it does start the server on http://localhost:5000.

Here are the logs:

```<code>Starting C-Store SCP server on port 11112
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
</code>```

However, since my GET endpoint fetches data from a local mongo server, when I try to run the GET endpoint http://localhost:5000/api/getItems it throws an error as shown below

```<code>Microsoft.AspNetCore.Server.Kestrel[13]
  Connection id "XXXXXXX", Request id "XXXXX": An unhandled exception was thrown by the application.
  System.ArgumentNullException: Value cannot be null. (Parameter 'connectionString')
     at MongoDB.Driver.Core.Misc.Ensure.IsNotNull[T](T value, String paramName)
     at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString, Boolean isInternalRepresentation, IDnsResolver dnsResolver)
     at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString)
     at MongoDB.Driver.MongoUrlBuilder.Parse(String url)
     at MongoDB.Driver.MongoUrlBuilder..ctor(String url)
     at MongoDB.Driver.MongoUrl..ctor(String url)
     at MongoDB.Driver.MongoClientSettings.FromConnectionString(String connectionString)
     at MongoDB.Driver.MongoClient..ctor(String connectionString)
</code>```

I am assuming this is because there's no mongodb server/driver in the executable?

I need some suggestion on how I can include the mongodb server on the executable which will automatically spin up once I run the executable. My overall goal is to have an executable for my dotnet project which contains a mongo server with it. Thanks!

Body:
I have created an installer for my dotnet project by running dotnet publish -r osx-arm64. However, when I try to run the executeable it looks like it does start the server on http://localhost:5000.

Here are the logs:

Starting C-Store SCP server on port 11112
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]

However, since my GET endpoint fetches data from a local mongo server, when I try to run the GET endpoint http://localhost:5000/api/getItems it throws an error as shown below

Microsoft.AspNetCore.Server.Kestrel[13]
  Connection id "XXXXXXX", Request id "XXXXX": An unhandled exception was thrown by the application.
  System.ArgumentNullException: Value cannot be null. (Parameter 'connectionString')
     at MongoDB.Driver.Core.Misc.Ensure.IsNotNull[T](T value, String paramName)
     at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString, Boolean isInternalRepresentation, IDnsResolver dnsResolver)
     at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString)
     at MongoDB.Driver.MongoUrlBuilder.Parse(String url)
     at MongoDB.Driver.MongoUrlBuilder..ctor(String url)
     at MongoDB.Driver.MongoUrl..ctor(String url)
     at MongoDB.Driver.MongoClientSettings.FromConnectionString(String connectionString)
     at MongoDB.Driver.MongoClient..ctor(String connectionString)

I am assuming this is because there's no mongodb server/driver in the executable?

I need some suggestion on how I can include the mongodb server on the executable which will automatically spin up once I run the executable. My overall goal is to have an executable for my dotnet project which contains a mongo server with it. Thanks!


问:
Opensearch filter by multiple fields with different values
The data from opensearch index:

```<code>{
    "_index" : "demoid",
    "_id" : "50014",
    "_score" : 1.0,
    "_source" : {
      "gender" : "FEMALE",
      "transactionNumber" : "JPP-SD",
      "shortname" : "nameS",
      "firstname" : "BLA BLA FIRST.",
      "result" : "SUCCESS",
      "channel" : "WEB",
      "status" : "COMPLETED",
      "@timestamp" : "2022-12-09T07:01:46.367349646Z",
      "id" : 50014
    }
</code>```

Mappings:
......

```<code>  "shortname": {
          "type": "keyword",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
     "status": {
          "type": "keyword"
        },
</code>```

.....  the ones used in fulltextsearch has the format in template as "shortname" the others like "status".

What i want to achieve is this:

I want to filter all the data by a given list of "status"es, "channel"s and "shortname"s and this result to be applied with a must option for a full text search over some columns.

I have tried using the term and terms into the filter, but for some reason this does not bring any data as a result...

This is the query i want:

```<code>GET demoid/_search
{
  "from": 0,
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "gender": "FEMALE"
          }
        },
        {
          "terms": {
            "channel": [
              "WEB", "Android"
            ]
          }
        }
      ],
      "must": [
        {
          "multi_match": {
            "fields": [
              "firstname",
              "shortname",
              "transactionNumber"
            ],
            "fuzziness": "AUTO",
            "query": "nameS"
          }
        }
      ]
    }
  },
  "size": 20,
  "sort": [
    {
      "shortname.keyword": {
        "order": "asc"
      }
    }
  ]
}
</code>```

However this brings no results:

```<code>{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  }
}
</code>```

But when i write it like this:

```<code>GET demoid/_search
{
  "from": 0,
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "fields": [
              "firstname",
              "shortname",
              "transactionNumber"
            ],
            "fuzziness": "AUTO",
            "query": "nameS"
          }
        },
        {
          "match": {
            "gender": "FEMALE"
          }
        }
      ],
      "should": [
        {
         "match": {
           "channel": "WEB"
         }
        },
        {
          "match": {
            "channel": "OtherChannel"
          }
        }
      ]
    }
  },
  "size": 20,
  "sort": [
    {
      "shortname.keyword": {
        "order": "asc"
      }
    }
  ]
}
</code>```

I receive the data correctly.

Took them one by one and seen that the issue is from filter. Does the filter allows only one "term" in it or does not do the thing that supposed to do?

image: opensearchproject/opensearch:2.3.0
image: opensearchproject/opensearch-dashboards:2.3.0

thank you!

PS: I have tried even here: https://playground.opensearch.org/app/dev_tools#/console

this query and no result:

```<code>GET opensearch_dashboards_sample_data_flights/_search
{
  "from": 0,
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "FlightNum": "9HY9SWR"
          }
        },
        {
          "terms": {
            "DestCountry": [
              "AU"
            ]
          }
        }
      ],
      "must": [
        {
          "match": {
            "DestCountry": {
              "query": "Sydney"
            }
          }
        }
      ]
    }
  },
  "size": 20
}
</code>```

Body:
The data from opensearch index:

{
    "_index" : "demoid",
    "_id" : "50014",
    "_score" : 1.0,
    "_source" : {
      "gender" : "FEMALE",
      "transactionNumber" : "JPP-SD",
      "shortname" : "nameS",
      "firstname" : "BLA BLA FIRST.",
      "result" : "SUCCESS",
      "channel" : "WEB",
      "status" : "COMPLETED",
      "@timestamp" : "2022-12-09T07:01:46.367349646Z",
      "id" : 50014
    }

Mappings:
......

  "shortname": {
          "type": "keyword",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
     "status": {
          "type": "keyword"
        },

.....  the ones used in fulltextsearch has the format in template as "shortname" the others like "status".

What i want to achieve is this:

I want to filter all the data by a given list of "status"es, "channel"s and "shortname"s and this result to be applied with a must option for a full text search over some columns.

I have tried using the term and terms into the filter, but for some reason this does not bring any data as a result...

This is the query i want:

GET demoid/_search
{
  "from": 0,
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "gender": "FEMALE"
          }
        },
        {
          "terms": {
            "channel": [
              "WEB", "Android"
            ]
          }
        }
      ],
      "must": [
        {
          "multi_match": {
            "fields": [
              "firstname",
              "shortname",
              "transactionNumber"
            ],
            "fuzziness": "AUTO",
            "query": "nameS"
          }
        }
      ]
    }
  },
  "size": 20,
  "sort": [
    {
      "shortname.keyword": {
        "order": "asc"
      }
    }
  ]
}

However this brings no results:

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  }
}

But when i write it like this:

GET demoid/_search
{
  "from": 0,
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "fields": [
              "firstname",
              "shortname",
              "transactionNumber"
            ],
            "fuzziness": "AUTO",
            "query": "nameS"
          }
        },
        {
          "match": {
            "gender": "FEMALE"
          }
        }
      ],
      "should": [
        {
         "match": {
           "channel": "WEB"
         }
        },
        {
          "match": {
            "channel": "OtherChannel"
          }
        }
      ]
    }
  },
  "size": 20,
  "sort": [
    {
      "shortname.keyword": {
        "order": "asc"
      }
    }
  ]
}

I receive the data correctly.

Took them one by one and seen that the issue is from filter. Does the filter allows only one "term" in it or does not do the thing that supposed to do?

image: opensearchproject/opensearch:2.3.0
image: opensearchproject/opensearch-dashboards:2.3.0

thank you!

PS: I have tried even here: https://playground.opensearch.org/app/dev_tools#/console

this query and no result:

GET opensearch_dashboards_sample_data_flights/_search
{
  "from": 0,
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "FlightNum": "9HY9SWR"
          }
        },
        {
          "terms": {
            "DestCountry": [
              "AU"
            ]
          }
        }
      ],
      "must": [
        {
          "match": {
            "DestCountry": {
              "query": "Sydney"
            }
          }
        }
      ]
    }
  },
  "size": 20
}


问:
How to compile a meson build directory in a cmake project
I want to add a meson build based intel realsense gstreamer plugin (https://github.com/WKDSMRT/realsense-gstreamer.git) to dlstreamer plugins (https://github.com/dlstreamer/dlstreamer.git)

I have created a CMakeLists file in the dlsteamer element directory and the compilation/make works.

Unfortunately, the shared library created after the cmake is not the same as in meson build and it misses plugin features. Is it possible to add a meson build to the existing Cmake project?


问:
Discord.py - Client object has no attribute 'http'
I'm trying to make a class which inherits discord.Client, original client.run() ran without error but error occured when I ran my class's run().

Exception has occurred: AttributeError
'nombotClient' object has no attribute 'http'

main.py

```<code>import nombot

with open("../config/token.txt") as token:
    token = token.readline()
    client = nombot.nombotClient(conn, cur)
    client.run(token) # <- ERROR
</code>```

nombot.py

```<code>import discord
from discord import app_commands

class nombotClient(discord.Client):
    def __init__(self, conn, cur):
        self.conn = conn
        self.cur = cur

    async def on_ready(self):
        print("loaded!")
</code>```

Body:
I'm trying to make a class which inherits discord.Client, original client.run() ran without error but error occured when I ran my class's run().

Exception has occurred: AttributeError
'nombotClient' object has no attribute 'http'

main.py

import nombot

with open("../config/token.txt") as token:
    token = token.readline()
    client = nombot.nombotClient(conn, cur)
    client.run(token) # <- ERROR

nombot.py

import discord
from discord import app_commands

class nombotClient(discord.Client):
    def __init__(self, conn, cur):
        self.conn = conn
        self.cur = cur

    async def on_ready(self):
        print("loaded!")


问:
How to calculate percent rank lookup from another column similar to Excel in Pandas
I would like to calculate the percent rank of some value when compared to another column in pandas. For example if I had a column with values [1,2,3,4], I would expect 1 to produce the rank of 0%, and 2 to produce 33%. The problem is that I don't necessarily want all of these in the same column.

The question I'm trying to answer is "What would this value have been ranked if it was in that column?" But I don't want this value to skew the percentiles of that column.
This is how I might normally generate percent ranks:

```<code>import pandas as pd
import numpy as np

# Generate Dummy Data
df_train = pd.DataFrame({'Values': 1000*np.random.rand(15712)})

#Sort Data
df_train = df_train.sort_values('Values')

# Calculating Rank and Rank_Pct for demo purposes
#but note that it is not needed for the solution
# The ranking of the validation data below does not depend on this
df_train['Rank'] = df_train.rank()
df_train['Rank_Pct']= df_train.Values.rank(pct=True)
</code>```

In excel, this is how I can achieve this:

Body:
I would like to calculate the percent rank of some value when compared to another column in pandas. For example if I had a column with values [1,2,3,4], I would expect 1 to produce the rank of 0%, and 2 to produce 33%. The problem is that I don't necessarily want all of these in the same column.

The question I'm trying to answer is "What would this value have been ranked if it was in that column?" But I don't want this value to skew the percentiles of that column.
This is how I might normally generate percent ranks:

import pandas as pd
import numpy as np

# Generate Dummy Data
df_train = pd.DataFrame({'Values': 1000*np.random.rand(15712)})

#Sort Data
df_train = df_train.sort_values('Values')

# Calculating Rank and Rank_Pct for demo purposes
#but note that it is not needed for the solution
# The ranking of the validation data below does not depend on this
df_train['Rank'] = df_train.rank()
df_train['Rank_Pct']= df_train.Values.rank(pct=True)

In excel, this is how I can achieve this:


问:
@MockBean working but @SpyBean has error: InvalidUseOfMatchersException
I using Spring Boot 2.7.6 with mockito 4.5.1.

I have a class DbSaver with one method

```<code>void saveResults(Input input, List<Map<String, Object>> results);
</code>```

In a Spring Boot Test with JUnit5 I have mocked this class with:

```<code>@MockBean
private DbSaver saver;
</code>```

and in my test I have the following:

```<code>doThrow(new IllegalArgumentException()).when(saver).saveResults(any(), any());
</code>```

If I execute the test everything works. No I have the need to change the @MockBean to @SpyBean and get for exactly this line the following error:

```<code>org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
1 matchers expected, 2 recorded
</code>```

Does someone has any idea what can be wrong here? I only change this annotation and with mock it works but with spy not.

I already tried to replace the any() with something like anyList() or the first with
any(Input.class) but nothing works.
I would expect, that @MockBean can be replaced with @SpyBean for this case, but unfortunately it was not working.

Body:
I using Spring Boot 2.7.6 with mockito 4.5.1.

I have a class DbSaver with one method

void saveResults(Input input, List<Map<String, Object>> results);

In a Spring Boot Test with JUnit5 I have mocked this class with:

@MockBean
private DbSaver saver;

and in my test I have the following:

doThrow(new IllegalArgumentException()).when(saver).saveResults(any(), any());

If I execute the test everything works. No I have the need to change the @MockBean to @SpyBean and get for exactly this line the following error:

org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
1 matchers expected, 2 recorded

Does someone has any idea what can be wrong here? I only change this annotation and with mock it works but with spy not.

I already tried to replace the any() with something like anyList() or the first with
any(Input.class) but nothing works.
I would expect, that @MockBean can be replaced with @SpyBean for this case, but unfortunately it was not working.


问:
How to correctly draw a path across the map borders in Leaflet?
The problem is when drawing a path across the map the points that should be on the right appears on the left:

I tried to fix it by checking whether the distance between longitudes of two consequent points of the path is greater than PI, and in that case adding PI to a point with the least longitude, but it doesn't seem to work:

const latlngs = points.map(pt => new L.LatLng(pt[1], pt[0]))
for (let i = 0; i < latlngs.length - 1; i++) {
  let [minLatLng, maxLatLng] = [latlngs[i], latlngs[i+1]];
  if (minLatLng.lng > maxLatLng.lng) {
    [minLatLng, maxLatLng] = [maxLatLng, minLatLng];
  }
  if (maxLatLng.lng - minLatLng.lng > Math.PI) {
    minLatLng.lng += Math.PI
  }
  const polyline = new L.Polyline([latlngs[i], latlngs[i+1]], {
    color: 'red',
    weight: 3,
    opacity: 0.5,
    smoothFactor: 1,
  });
  polyline.addTo(map);
}
```


问:
What is the "Comments" feature in VSCode?
The settings window for features>comments and the comments panel

I looked up other posts but obviously comments is a bit hard to google in relation with a code editor. I also looked at the docs but couldn't find anything there. I also located the source (src/vs/workbench/contrib/comments) and couldn't find anything helpful there.


问:
Vertex AI - Juypiter Notebook. Error when running 'pip install kfp'
I'm having problems running this command in a managed Vertex AI Notebook:
pip install kfp

I get the following error:
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/opt/conda/lib/python3.7/site-packages/six-1.16.0.dist-info/METADATA'

Which I believe has to do with the MAX_PATH limitation. But I haven't confirmed this.

The same command works on my personal GCP account, but when moving the notebook to my work organization I run into this issue.

Can anyone tell me how to change this limitation in GCP or alternatively point me to another way of resolving this problem?

Thanks in advance


问:
Mat Icon svgIcon load icon slowly
I have an SVG icon loading by Mat Icon but it loads the SVG slowly:

.ts

```<code>this.matIconRegistry.addSvgIcon(
   'icon-info',
   this.domSanitizer.bypassSecurityTrustResourceUrl('../img/icon-info.svg')
);
</code>```

.HTML

```<code><mat-icon svgIcon="icon-info" class="icon"></mat-icon>
</code>```

Any suggestion to fix the loading performance?

Title: Mat Icon svgIcon load icon slowly

Body:
I have an SVG icon loading by Mat Icon but it loads the SVG slowly:

.ts

this.matIconRegistry.addSvgIcon(
   'icon-info',
   this.domSanitizer.bypassSecurityTrustResourceUrl('../img/icon-info.svg')
);

.HTML

<mat-icon svgIcon="icon-info" class="icon"></mat-icon>

Any suggestion to fix the loading performance?


问:
resx - Designer.cs comment language
Our team is using different languages when using Visual Studio. (some German, some English)

And we get everytime conflicts with the auto generated

```<code>eng: <summary> Looks up a localized string similar to ...
de:  <summary> Sucht eine lokalisierte Zeichenfolge,
</code>```

comments of each corresponding resource in the Designer.cs file when we are commiting/pushing changes.

Is there a proper solution for that ?

Title: resx - Designer.cs comment language

Body:
Our team is using different languages when using Visual Studio. (some German, some English)

And we get everytime conflicts with the auto generated

eng:  Looks up a localized string similar to ...
de:   Sucht eine lokalisierte Zeichenfolge,

comments of each corresponding resource in the Designer.cs file when we are commiting/pushing changes.

Is there a proper solution for that ?


问:
Unclick a button in unity
I have a Gameobject in my scene whitch contains a Button.
Player can use Button to climb up a ladder when the character is by a ladder.
And I want Button to be Disabled(deactived) when the character is not near a ladder.

When player is holding the Button and getting away from the ladder on the same time, the Button will be Disabled.
And the next time when player goes near a ladder and Button will be actived, player is not clicking the button. But the Button has been holded since last time, and player will climb up the ladder.

Does any one know how to unclick a button(Opposite of OnClick) from the code??

Title: Unclick a button in unity


问:
Tiny single Bidirectional layer big RAM usage?
I have several different small models 1-2MB size on disk, some are just fully connected layers, Transformer, and a couple of Bidirectional GRU networks. But they have very different memory requirements when I load them in TensorFlow Serving.

Does anyone know why the Bidirectional GRU network a very simple one shown below takes >100MB to load compared to a Transformer with several layers and double the number of weights which only takes half the RAM of 50MB to load, (the fully connected networks are very small 5-10MB RAM).

```<code> vocab_size = 200
 embedding_dim = 32
 enc_units = 64

 self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)
 gru = tf.keras.layers.GRU(enc_units,
    return_sequences=True,
    recurrent_initializer="glorot_uniform",
  )
 self.bidi = tf.keras.layers.Bidirectional(gru, merge_mode="concat")
</code>```

Any way to reduce the RAM requirements for the network?

I tried reducing the enc_units from 64 to 32, same for embedding_dim 64->32, but that didn't change the RAM usage at all.

Body:
I have several different small models 1-2MB size on disk, some are just fully connected layers, Transformer, and a couple of Bidirectional GRU networks. But they have very different memory requirements when I load them in TensorFlow Serving.

Does anyone know why the Bidirectional GRU network a very simple one shown below takes >100MB to load compared to a Transformer with several layers and double the number of weights which only takes half the RAM of 50MB to load, (the fully connected networks are very small 5-10MB RAM).

 vocab_size = 200
 embedding_dim = 32
 enc_units = 64

 self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)
 gru = tf.keras.layers.GRU(enc_units,
    return_sequences=True,
    recurrent_initializer="glorot_uniform",
  )
 self.bidi = tf.keras.layers.Bidirectional(gru, merge_mode="concat")

Any way to reduce the RAM requirements for the network?

I tried reducing the enc_units from 64 to 32, same for embedding_dim 64->32, but that didn't change the RAM usage at all.


问:
How to get PHP 8.0.26 with PDO running on MS server 2019 IIS 10?
I have MS Server 2019 Standard edition, IIS 10.0.17763.1, Visual C++ 2019, PHP 8.0.26 NTS x64, and php_pdo_sqlsrv_80_nts.dll extension enabled.  I'm able to connect to MS Access 2007 database and run a query.  I'm able to query the database and return 50 records.  The script randomly stops working and I get a 500 error.  The Windows Application log returns

Faulting module name: ucrtbase.dll, version: 10.0.17763.1490, time stamp: 0x48ac8393
Exception code: 0xc0000409
Fault offset: 0x000000000006e77e
Faulting process id: 0x1a54
Faulting application start time: 0x01d90be40a629837
Faulting application path: C:\PHP8\php-cgi.exe
Faulting module path: C:\Windows\System32\ucrtbase.dll

I have tried PHP 8.0.26, 8.1.13, and 8.2.0, both NTS and TS, both x86 and 64.

I searched for Faulting module name: ucrtbase.dll, version: 10.0.17763.1490 error and tried command with no luck

DISM.exe /Online /Cleanup-image /Restorehealth

Does anyone else experience this?  Does anyone have php8* with PDO working on IIS and if so what did you install and what is your configuration?


问:
convert a pinescript v2 script to pinescript v5
I can't convert this script to v5, do you have any ideas on how I can do it?

```<code>//@version=2
strategy("Fractal Breakout Strategy (by ChartArt)", shorttitle="CA_-_Fractal_Breakout_Strat", overlay=true)

// input
n_time = input(title='Always exit each trade after this amount of bars later (Most important strategy setting)', defval=3, type=integer)
price = input(hl2,title='Price type to determine the last fractal top and the fractal breakout, the default is (high+low)/2')

// fractal calculation
fractal_top = high[2] > high[3] and high[2] > high[4] and high[2] > high[1] and high[2] > high[0]
fractal_price = valuewhen(fractal_top, price, 1)
use_longer_average = input(true,title='Use Fractal price average of the last 3 fractals instead of the last 2 fractals?')
fractal_average = use_longer_average?(fractal_price[1] + fractal_price[2] + fractal_price[3] ) / 3 : (fractal_price[1] + fractal_price[2]) / 2
fractal_trend = fractal_average[0] > fractal_average[1]
no_repainting = input(true,title='Use the price of the last bar to prevent repainting?')
fractal_breakout = no_repainting?price[1] > fractal_price[0]:price[0] > fractal_price[0]

// highlight fractal tops
show_highlight = input(true,title='Highlight fractal tops in blue and color all other bars in gray?')
highlight = fractal_top?blue:silver
barcolor(show_highlight?highlight:na,offset=-2)
show_fractal_top_line = input(true,title='Draw a colored line based on the fractal tops?')
fractal_top_line = change(fractal_top) != 0 ? price : na
fractal_top_line_color = change(fractal_price) > 0 and fractal_breakout == true ? green : change(fractal_price) < 0 and fractal_breakout == false ? red : blue
plot(show_fractal_top_line?fractal_top_line:na,offset=-2,color=fractal_top_line_color,linewidth=4)

// strategy
trade_entry = fractal_trend and fractal_breakout
trade_exit = fractal_trend[n_time] and fractal_trend == false

if (trade_entry)
    strategy.entry('Long', strategy.long)

if (trade_exit)
    strategy.close('Long')
</code>```

I tried to convert it to v3 and then go through the trading view converter but I can't find the same results!

Body:
I can't convert this script to v5, do you have any ideas on how I can do it?

//@version=2
strategy("Fractal Breakout Strategy (by ChartArt)", shorttitle="CA_-_Fractal_Breakout_Strat", overlay=true)

// input
n_time = input(title='Always exit each trade after this amount of bars later (Most important strategy setting)', defval=3, type=integer)
price = input(hl2,title='Price type to determine the last fractal top and the fractal breakout, the default is (high+low)/2')

// fractal calculation
fractal_top = high[2] > high[3] and high[2] > high[4] and high[2] > high[1] and high[2] > high[0]
fractal_price = valuewhen(fractal_top, price, 1)
use_longer_average = input(true,title='Use Fractal price average of the last 3 fractals instead of the last 2 fractals?')
fractal_average = use_longer_average?(fractal_price[1] + fractal_price[2] + fractal_price[3] ) / 3 : (fractal_price[1] + fractal_price[2]) / 2
fractal_trend = fractal_average[0] > fractal_average[1]
no_repainting = input(true,title='Use the price of the last bar to prevent repainting?')
fractal_breakout = no_repainting?price[1] > fractal_price[0]:price[0] > fractal_price[0]

// highlight fractal tops
show_highlight = input(true,title='Highlight fractal tops in blue and color all other bars in gray?')
highlight = fractal_top?blue:silver
barcolor(show_highlight?highlight:na,offset=-2)
show_fractal_top_line = input(true,title='Draw a colored line based on the fractal tops?')
fractal_top_line = change(fractal_top) != 0 ? price : na
fractal_top_line_color = change(fractal_price) > 0 and fractal_breakout == true ? green : change(fractal_price) < 0 and fractal_breakout == false ? red : blue
plot(show_fractal_top_line?fractal_top_line:na,offset=-2,color=fractal_top_line_color,linewidth=4)

// strategy
trade_entry = fractal_trend and fractal_breakout
trade_exit = fractal_trend[n_time] and fractal_trend == false

if (trade_entry)
    strategy.entry('Long', strategy.long)

if (trade_exit)
    strategy.close('Long')

I tried to convert it to v3 and then go through the trading view converter but I can't find the same results!


问:
create-react-app building every package in monorepo
I have a monorepo with ~10 packages or so and when I build using

```<code>        "build": " react-scripts build",

</code>```

the performance is very bad as in taking 1-1:30minutes to compile

I noticed when browse through the generated js file that I can find function that are inside an other package imbeded in the react app.

I was wondering if there is a way to optimise the build so it doesn't take that long since it's not a big react app

my project structure is
root

```<code>----packages
    ----folder1
        ----package1
        ----package2
        ...
        ----CRApackage
</code>```

the CRA package has an import on package1 with a reference defined on the tsconfig

I'm not familiar with react and webpack so I don't really know how to tackle this issue

Body:
I have a monorepo with ~10 packages or so and when I build using

        "build": " react-scripts build",

the performance is very bad as in taking 1-1:30minutes to compile

I noticed when browse through the generated js file that I can find function that are inside an other package imbeded in the react app.

I was wondering if there is a way to optimise the build so it doesn't take that long since it's not a big react app

my project structure is
root

----packages
    ----folder1
        ----package1
        ----package2
        ...
        ----CRApackage

the CRA package has an import on package1 with a reference defined on the tsconfig

I'm not familiar with react and webpack so I don't really know how to tackle this issue


问:
Directive change lags by one input when assigning text to another input
i have a custom directive where i implemented ng-change:

```<code>moduloDirettive.directive('inputDir',function () {
    return {
        restrict : 'EA',
        transclude : 'true',
        replace: true,
        scope : {
            collectorId : '@',
            label : '@',
            model : '=',
            disable : '=?',
            placeholder : '@',
            formName : '=',
            help : '@',
            type : '@',
            change : '&',
            min : '=',
            max : '=',
            fieldName : '@',
            config : '=',
            required : '=',
            tooltip: '=',
            pattern : '=ngPattern',
        },
        templateUrl : currentScriptPath + 'input.html',
        link : function (scope, elm, attrs, ngModelCtrl) {
            if (scope.config) {
                scope.class = scope.config.class;
                scope.type = scope.config.type;
            }

            scope.onChange = function () {
                setTimeout(scope.change, 0);
            }

        },
        controller: ['$scope', '$labelRegistrationDirFactory', function($scope, $labelRegistrationDirFactory){
            if ($scope.label && $scope.label != '' && $scope.collectorId && $scope.collectorId != '') {
                $labelRegistrationDirFactory.register($scope.collectorId,  $scope.fieldName, $scope.label);
            }

        }]
    };
});
</code>```

I used it on this field:

```<code><input-dir label="{{::translate('rito.descrizioneregistro')}}"
                               required="true" form-name="form" field-name="descrizioneregistro"
                               model="formDataDetail.descrizioneRegistro" change="descrizioneRito()"></input-dir>
</code>```

and this is how i assign value:

```<code>$scope.descrizioneRito = function() {
            $scope.formDataDetail.descrizioneRitoAV = $scope.formDataDetail.descrizioneRegistro;
        }
</code>```

but whenever i write inside the input, it lags by one action, so if if i write "try", i will have "tr" on the other input, and so on.
How can i fix this?
Thank you

Body:
i have a custom directive where i implemented ng-change:

moduloDirettive.directive('inputDir',function () {
    return {
        restrict : 'EA',
        transclude : 'true',
        replace: true,
        scope : {
            collectorId : '@',
            label : '@',
            model : '=',
            disable : '=?',
            placeholder : '@',
            formName : '=',
            help : '@',
            type : '@',
            change : '&',
            min : '=',
            max : '=',
            fieldName : '@',
            config : '=',
            required : '=',
            tooltip: '=',
            pattern : '=ngPattern',
        },
        templateUrl : currentScriptPath + 'input.html',
        link : function (scope, elm, attrs, ngModelCtrl) {
            if (scope.config) {
                scope.class = scope.config.class;
                scope.type = scope.config.type;
            }

            scope.onChange = function () {
                setTimeout(scope.change, 0);
            }

        },
        controller: ['$scope', '$labelRegistrationDirFactory', function($scope, $labelRegistrationDirFactory){
            if ($scope.label && $scope.label != '' && $scope.collectorId && $scope.collectorId != '') {
                $labelRegistrationDirFactory.register($scope.collectorId,  $scope.fieldName, $scope.label);
            }

        }]
    };
});

I used it on this field:

<input-dir label="{{::translate('rito.descrizioneregistro')}}"
                               required="true" form-name="form" field-name="descrizioneregistro"
                               model="formDataDetail.descrizioneRegistro" change="descrizioneRito()"></input-dir>

and this is how i assign value:

$scope.descrizioneRito = function() {
            $scope.formDataDetail.descrizioneRitoAV = $scope.formDataDetail.descrizioneRegistro;
        }

but whenever i write inside the input, it lags by one action, so if if i write "try", i will have "tr" on the other input, and so on.
How can i fix this?
Thank you


问:
Zabbix LLD Prometheus format metrics
I am trying to parse some Prometheus format metrics by Zabbix discovery rule.
I have metrics like that:

```<code>asg_instance_metadata{id="i-***", tag="ASG_DESIRED_NUM"} 3
asg_instance_metadata{id="i-***", tag="ASG_MAX_SIZE"} 10
asg_instance_metadata{id="i-***", tag="ASG_MIN_SIZE"} 3
asg_instance_metadata{id="i-***", tag="alpha.eksctl.io/nodegroup-type"} unmanaged
asg_instance_metadata{id="i-***", tag="aws:ec2launchtemplate:id"} lt-***
</code>```

I use "Prometheus to JSON" preprocessing for discovery rule.

In case of first three lines - it is parsing and converting to JSON without any problems, but next metrics can't be parsed, i am getting next error:

cannot convert Prometheus data to JSON: data parsing error at row 4
"asg_instance_metadata{id="i-***", ta...": cannot parse
metric value

In these Zabbix docs

Link1

Link2

I see examples only with INT values.

So can someone help me? Is it possible to use string values in prometheuse format metrics?

My discovery rule configuration:

Title: Zabbix LLD Prometheus format metrics

Body:
I am trying to parse some Prometheus format metrics by Zabbix discovery rule.
I have metrics like that:

asg_instance_metadata{id="i-***", tag="ASG_DESIRED_NUM"} 3
asg_instance_metadata{id="i-***", tag="ASG_MAX_SIZE"} 10
asg_instance_metadata{id="i-***", tag="ASG_MIN_SIZE"} 3
asg_instance_metadata{id="i-***", tag="alpha.eksctl.io/nodegroup-type"} unmanaged
asg_instance_metadata{id="i-***", tag="aws:ec2launchtemplate:id"} lt-***

I use "Prometheus to JSON" preprocessing for discovery rule.

In case of first three lines - it is parsing and converting to JSON without any problems, but next metrics can't be parsed, i am getting next error:

cannot convert Prometheus data to JSON: data parsing error at row 4
"asg_instance_metadata{id="i-***", ta...": cannot parse
metric value

In these Zabbix docs

Link1

Link2

I see examples only with INT values.

So can someone help me? Is it possible to use string values in prometheuse format metrics?

My discovery rule configuration:


问:
Query mysql rds audit log from client
I created a MySQL rds database with an option group who has the option MARIADB_AUDIT_PLUGIN enabled ¿Is there a way to query the audit file this option generates (see uploaded image) directly from mysql workbench or any mysql client, without having to go to the aws console and access the file or download it ?

file in aws console

Title: Query mysql rds audit log from client


问:
Excel VLOOKUP help .... cannot get referenced column correct
I am not a noob but Excel and VLookups ... all I want is lookup name to contain the value 1 or 2 and retrieved from the lookups worksheet (and not show #N/A). Simple but I cannot get there. It has to be an exact match. The screenshot shows my current VLOOKUP formula that is clearly wrong.


问:
Wrapper for rhel7 only
I have a wrapper script that runs different versions of programs based on what machine it is (32/64 bit). I want to add a line to it saying run this command only if on a rhel7 machine. Any ideas how to do this? What would be a rhel7 machine identifier the system would understand?
Thanks!</p>

Title: Wrapper for rhel7 only


问:
Unexpected token ':' using node-webvtt parser package unsure reason of the error?
Hey I am trying to parse a webvtt file in javascript and I wrapped the process in a try catch and it throws this error at me unsure why. Would appreciate any insight. I am using the node-webvtt package node-webvtt.

I have the full vtt file but decided to just take the first example from it and put it as a string. I have tried passing in the whole file and still get the same error. I think I might have structured the try catch incorrectly but I still got the same error not using a try catch block.

The block of code:

```<code>const parsed = (err) => {
    try{
        webvtt.parse(`WEBVTT

1
00:02:57,642 --> 00:02:58,672
Happy Monday, everybody.`);
    }catch(err){
        console.log(err);
    }
}
</code>```

Body:
Hey I am trying to parse a webvtt file in javascript and I wrapped the process in a try catch and it throws this error at me unsure why. Would appreciate any insight. I am using the node-webvtt package node-webvtt.

I have the full vtt file but decided to just take the first example from it and put it as a string. I have tried passing in the whole file and still get the same error. I think I might have structured the try catch incorrectly but I still got the same error not using a try catch block.

The block of code:

const parsed = (err) => {
    try{
        webvtt.parse(`WEBVTT

1
00:02:57,642 --> 00:02:58,672
Happy Monday, everybody.`);
    }catch(err){
        console.log(err);
    }
}


问:
Python file not created if function is ran in thread
Github repo - Github Repo
I have a function

def sepLastData(data: pd.DataFrame, config: dict, folderPath: str = None) -> None:
    """
    Seperates last data based on config.

    Config preview=>
    config={
        "lastData":['close','RSI','RSISMA100'],
    }
    """
    if folderPath is None:
        folderPath = outputPath
    d = data.iloc[-1]
    toFetch = config["lastData"]
    with open(os.path.join(folderPath, 'lastData.csv'), 'wt', encoding="UTF-8") as file:
        for fetch in toFetch:
            file.write(fetch)
            file.write(',')
        file.write('\n')
        for fetch in toFetch:
            file.write(str(d[fetch]))
            file.write(',')
        file.close()
```
<p>When I run the function normally it creates lastData.csv but when I run the function in a different thread then it doesn't create the lastData.csv.</p>
<p>The project collects crypto data using ccxt and does some calculations on it, then stores the data in different csv files like lastData.csv(last candlestick data), main.csv(candlestick chart data), etc.
The calculations take almost 1-2 sec, but I have to run it threaded as thousands of symbols will have to be calculated and all of them should be at single time.</p>
<p>NOTE: every other function creates their respective file in threaded mode except <code>sepLastData</code></p>
<p>How to run the program->
run the <code>run.py</code>
How to switch between normal and threaded-></p>
<pre class="lang-py prettyprint-override"><code># run.py
for symbol in config["symbols"]:
    for timeframe in symbol["timeframe"]:
        getData(symbol,timeframe)
        # makeThread(getData,symbol,timeframe)
</code>```

Just uncomment makeThread(getData,symbol,timeframe) line and comment getData(symbol,timeframe) line.

All the functions for creating files are in prepData/seperateData.py in which sepLastData is problematic.

Python version - 3.10.8
Required library -pandas , ccxt , numpy

I would like to know the reason for the error as well as fixes as soon as possible.

Body:
Github repo - Github Repo
I have a function

def sepLastData(data: pd.DataFrame, config: dict, folderPath: str = None) -> None:
    """
    Seperates last data based on config.

    Config preview=>
    config={
        "lastData":['close','RSI','RSISMA100'],
    }
    """
    if folderPath is None:
        folderPath = outputPath
    d = data.iloc[-1]
    toFetch = config["lastData"]
    with open(os.path.join(folderPath, 'lastData.csv'), 'wt', encoding="UTF-8") as file:
        for fetch in toFetch:
            file.write(fetch)
            file.write(',')
        file.write('\n')
        for fetch in toFetch:
            file.write(str(d[fetch]))
            file.write(',')
        file.close()

When I run the function normally it creates lastData.csv but when I run the function in a different thread then it doesn't create the lastData.csv.

The project collects crypto data using ccxt and does some calculations on it, then stores the data in different csv files like lastData.csv(last candlestick data), main.csv(candlestick chart data), etc.
The calculations take almost 1-2 sec, but I have to run it threaded as thousands of symbols will have to be calculated and all of them should be at single time.

NOTE: every other function creates their respective file in threaded mode except sepLastData

How to run the program->
run the run.py
How to switch between normal and threaded->

# run.py
for symbol in config["symbols"]:
    for timeframe in symbol["timeframe"]:
        getData(symbol,timeframe)
        # makeThread(getData,symbol,timeframe)

Just uncomment makeThread(getData,symbol,timeframe) line and comment getData(symbol,timeframe) line.

All the functions for creating files are in prepData/seperateData.py in which sepLastData is problematic.

Python version - 3.10.8
Required library -pandas , ccxt , numpy

I would like to know the reason for the error as well as fixes as soon as possible.


问:
VBA Excel and R
I am looking for a way to connect and communicate with R from excel. The solution I found is Rexcel which seems to be almost 10 years old and does not work with Excel 365. Is there a new way available to interact with R from Excel?</p>

Title: VBA Excel and R


问:
Android: ImageView with svg looks blurry
I'm many svg exported from Adobe illustrator, it only have a size of 9.36*10.8.
When I use the xml vector of this svg (converted by Android Studio) as the src of ImageView with a size of 19.5dp * 22.5dp, the imageview looks blurr.
Shouldn't have svg have the ability to scale without any blurr?
I can't change the viewportWidth or viewportHeight.

P.S: I have enabled hardwareAcclerate, does that have issue with vector drawable too?

Sample SVG (I used this in BottomNavigationView item, it looks very blurry):

```<code><vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="6.4771dp"
    android:height="7.92dp"
    android:viewportWidth="6.4771"
    android:viewportHeight="7.92">
  <path
      android:fillColor="#cacaca"
      android:pathData="M3.2386,4.3201c1.0975,0 1.9791,-0.9702 1.9791,-2.16S4.3361,0 3.2386,0c-1.0975,0 -1.9791,0.9702 -1.9791,2.16s0.8816,2.16 1.9791,2.16ZM6.2722,5.625c-0.2732,-0.4733 -0.778,-0.765 -1.3244,-0.765L1.5293,4.86c-0.8446,0 -1.5293,0.685 -1.5293,1.53 0.001,0.8446 0.6851,1.5291 1.5293,1.53h3.4185c0.5464,0 1.0512,-0.2916 1.3244,-0.765s0.2732,-1.0566 0,-1.53Z" />
</vector>
</code>```

I'm running Android 13 with AndroidX, Target Version 32 without any support library. Gradle 7.5.1

Body:
I'm many svg exported from Adobe illustrator, it only have a size of 9.36*10.8.
When I use the xml vector of this svg (converted by Android Studio) as the src of ImageView with a size of 19.5dp * 22.5dp, the imageview looks blurr.
Shouldn't have svg have the ability to scale without any blurr?
I can't change the viewportWidth or viewportHeight.

P.S: I have enabled hardwareAcclerate, does that have issue with vector drawable too?

Sample SVG (I used this in BottomNavigationView item, it looks very blurry):

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="6.4771dp"
    android:height="7.92dp"
    android:viewportWidth="6.4771"
    android:viewportHeight="7.92">
  <path
      android:fillColor="#cacaca"
      android:pathData="M3.2386,4.3201c1.0975,0 1.9791,-0.9702 1.9791,-2.16S4.3361,0 3.2386,0c-1.0975,0 -1.9791,0.9702 -1.9791,2.16s0.8816,2.16 1.9791,2.16ZM6.2722,5.625c-0.2732,-0.4733 -0.778,-0.765 -1.3244,-0.765L1.5293,4.86c-0.8446,0 -1.5293,0.685 -1.5293,1.53 0.001,0.8446 0.6851,1.5291 1.5293,1.53h3.4185c0.5464,0 1.0512,-0.2916 1.3244,-0.765s0.2732,-1.0566 0,-1.53Z" />
</vector>

I'm running Android 13 with AndroidX, Target Version 32 without any support library. Gradle 7.5.1


问:
Excel Formula to Remove/Replace parts of Column Texts and End of Text
I have this in a column:  https://wrongSite.com/RandomTextToRemove/RandomAmountsOfTextCanBeHere/alwaysTheSameNameFolderForKeyingON/RandomText/RandomText/RandomText/RandomText/RandomText.html

So remove anything in front of alwaysTheSameNameFolderForKeyingON and replace with https://rightSite.com/.  Then trim off the .html

I want this: https://rightSite.com/alwaysTheSameNameFolderForKeyingON/RandomText/RandomText/RandomText/RandomText (remove .html)

Something like this is as far as I got: So I have this now SUBSTITUTE(SUBSTITUTE(text, old_text1, "rightSite.com"), ".html",)), but old_text1 is always changing - I need whatever is in front of /alwaysTheSameNameFolderForKeyingON to be old_text1. The other parts work


问:
Get semantic token range at position
How can I get semantic token range at certain position?

Title: Get semantic token range at position


问:
Logit scale in Plotly Express
My goal is to get a probability plot with the logit scale using Plotly Express (px).

In Matplotlib (plt) this is possible:

```<code>x, y = ([1, 2, 3], [1, 3, 2])
fig, ax = plt.subplots()
ax.scatter(x, y)
ax.set_yscale("logit")
</code>```

Is there any comparable functionality in px?

The workaround I am trying currently is to get these ticks from plt and give them as parameters to px. That does work, but only changes the tick labels, not the actual scale of the y axis:

```<code>ytickvals = ax.get_yticks()
fig = px.scatter(x, y)
layout = dict(
    yaxis=dict(
        tickmode="array",
        tickvals=ytickvals
    )
)
fig.update_layout(layout)
</code>```

How can I set the scale of the Plotly plot to be like the logit scale of Matplotlib?

Plotly API documentation doesn't know the term "logit" and plotly.graph_objects.layout.YAxis seems to not have a way of setting the scale.

PS, bonus question: why do my ticks not get displayed with the suffix using ticksuffix=" %" and showticksuffix="all"?

Title: Logit scale in Plotly Express

Body:
My goal is to get a probability plot with the logit scale using Plotly Express (px).

In Matplotlib (plt) this is possible:

x, y = ([1, 2, 3], [1, 3, 2])
fig, ax = plt.subplots()
ax.scatter(x, y)
ax.set_yscale("logit")

Is there any comparable functionality in px?

The workaround I am trying currently is to get these ticks from plt and give them as parameters to px. That does work, but only changes the tick labels, not the actual scale of the y axis:

ytickvals = ax.get_yticks()
fig = px.scatter(x, y)
layout = dict(
    yaxis=dict(
        tickmode="array",
        tickvals=ytickvals
    )
)
fig.update_layout(layout)

How can I set the scale of the Plotly plot to be like the logit scale of Matplotlib?

Plotly API documentation doesn't know the term "logit" and plotly.graph_objects.layout.YAxis seems to not have a way of setting the scale.

PS, bonus question: why do my ticks not get displayed with the suffix using ticksuffix=" %" and showticksuffix="all"?


问:
C fgets giving unexpected result
I'm doing Advent of Code 2022, and I'm hitting a strange bug for day 1 (https://adventofcode.com/2022/day/1) which I need help with please.

Currently, I'm trying to parse a text file which has groups of numbers (https://adventofcode.com/2022/day/1/input) and output the results to the screen. Code as follows:

```<code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define IN_FILE "input.txt"
#define MAX_LINE_LEN 20480

int main(int argc, char *argv[])
{
    // Variable declaration
    char line[MAX_LINE_LEN];
    int counter = 0;
    int elfno = 0;
    FILE *fd;

    // Create "Key Value pair" struct. Use ints for both vars as we need to perform arithmetic on the values.
    struct kv_store
    {
        int key;
        int value;
    };

    struct kv_store kv[counter];
    //struct kv_store kv_total;

    // Open file

    fd = fopen(IN_FILE, "r");
    if (fd == NULL)
    {
        // File does not exist. Exit
        fprintf(stdout, "\n[*]%s not found in current working directory.", IN_FILE);
        return -1;
    }

    // Iterate through file line by line. Place lines into kv[n].value with kv[n].key as the elf number (elfno). Increment elfno once a blank line is found.
    while(fgets(line, MAX_LINE_LEN, fd) != NULL)
    {
        if(strlen(line) == 1)
        {
            elfno ++;
            continue;
        }
        else
        {
            kv[counter].key = elfno;
            sscanf(line, "%d", &kv[counter].value);
            //kv[counter].value = strtol(line, NULL, 0);
            counter ++;
            continue;
        }
    }

    for(int i=0;i < counter;i++)
    {
        fprintf(stdout, "Iteration: %d - Elf: %d holds: %d \n", i, kv[i].key, kv[i].value);
    }

    // TODO: Upon EOF, we can iterate through kv. If elfno for next value in kv hasn't changed, add value to kv_total[elfno].value. If it does change, move on to the next efls values.

    // TODO: Once complete, iterate through kv_total and find the largest number, print to screen.
    return 0;
}
</code>```

Everything seems to be working ok, however on the 4th iteration of the while loop which reads the value 6086 from the input, I get a garbage result. I should be seeing Elf: 1 holds: 6086. The remaining iterations give the correct output (sample screenshot below).

Using my very limited knowledge of gdb and debugging, I've looked at the line variable during runtime and can see that the variable is being modified only when line contains the value 6086 partway through the iteration (screenshot below).

Checks carried out so far:

Used a hex editor to confirm there is no rogue encoding within the input file

Tried using strtol instead of of sscanf

Tried to use malloc() and free() to clear the line variable at the end of each iteration

Any help on this would be much appreciated.

Title: C fgets giving unexpected result

Body:
I'm doing Advent of Code 2022, and I'm hitting a strange bug for day 1 (https://adventofcode.com/2022/day/1) which I need help with please.

Currently, I'm trying to parse a text file which has groups of numbers (https://adventofcode.com/2022/day/1/input) and output the results to the screen. Code as follows:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define IN_FILE "input.txt"
#define MAX_LINE_LEN 20480

int main(int argc, char *argv[])
{
    // Variable declaration
    char line[MAX_LINE_LEN];
    int counter = 0;
    int elfno = 0;
    FILE *fd;

    // Create "Key Value pair" struct. Use ints for both vars as we need to perform arithmetic on the values.
    struct kv_store
    {
        int key;
        int value;
    };

    struct kv_store kv[counter];
    //struct kv_store kv_total;

    // Open file

    fd = fopen(IN_FILE, "r");
    if (fd == NULL)
    {
        // File does not exist. Exit
        fprintf(stdout, "\n[*]%s not found in current working directory.", IN_FILE);
        return -1;
    }

    // Iterate through file line by line. Place lines into kv[n].value with kv[n].key as the elf number (elfno). Increment elfno once a blank line is found.
    while(fgets(line, MAX_LINE_LEN, fd) != NULL)
    {
        if(strlen(line) == 1)
        {
            elfno ++;
            continue;
        }
        else
        {
            kv[counter].key = elfno;
            sscanf(line, "%d", &kv[counter].value);
            //kv[counter].value = strtol(line, NULL, 0);
            counter ++;
            continue;
        }
    }

    for(int i=0;i < counter;i++)
    {
        fprintf(stdout, "Iteration: %d - Elf: %d holds: %d \n", i, kv[i].key, kv[i].value);
    }

    // TODO: Upon EOF, we can iterate through kv. If elfno for next value in kv hasn't changed, add value to kv_total[elfno].value. If it does change, move on to the next efls values.

    // TODO: Once complete, iterate through kv_total and find the largest number, print to screen.
    return 0;
}

Everything seems to be working ok, however on the 4th iteration of the while loop which reads the value 6086 from the input, I get a garbage result. I should be seeing Elf: 1 holds: 6086. The remaining iterations give the correct output (sample screenshot below).

Using my very limited knowledge of gdb and debugging, I've looked at the line variable during runtime and can see that the variable is being modified only when line contains the value 6086 partway through the iteration (screenshot below).

Checks carried out so far:

Used a hex editor to confirm there is no rogue encoding within the input file

Tried using strtol instead of of sscanf

Tried to use malloc() and free() to clear the line variable at the end of each iteration

Any help on this would be much appreciated.


问:
keras model.evaluate and sklearn roc_auc_score give different results
I am training a brain tumour classification model in Keras and I am interested in the AUC metric. By using keras model.evaluate with the test generator I obtain an AUC of 0.65 but, computing the AUC with sklearn roc_auc_score I obtain, 0.49, a completely different result (which does not make sense being less than 0.5) It does not make sense to me. Does it has an explanation or am I doing something wrong?

Model:

```<code># Build model
base_model = VGG16(include_top=False, input_shape=(224, 224, 3), weights='imagenet')
base_model.trainable = False

inputs = keras.Input(shape=(224, 224, 3))
x = base_model(inputs, training=False)
# Convert features of shape `base_model.output_shape[1:]` to vectors
x = keras.layers.GlobalAveragePooling2D()(x)
# A Dense classifier for binary classification
x = keras.layers.Dense(128, activation='relu')(x)
x = keras.layers.Dense(64, activation='relu')(x)
x = keras.layers.Dense(32, activation='relu')(x)
outputs = keras.layers.Dense(1, activation='sigmoid')(x)
model = keras.Model(inputs, outputs)
model.summary()
</code>```

Compile:

```<code>from tensorflow.keras.metrics import AUC

# Configure the model for training.
model.compile(optimizer=fit_optimizer, loss=loss_function, metrics=['accuracy', AUC()])
</code>```

Evaluation with Keras:

```<code># Evaluate the model
test_generator.reset()
score = model.evaluate(test_generator, verbose=0)

print(f"Loss: {str(score[0])} \nAccuracy on test: {str(score[1])}\n AUC: {str(score[2])}")

</code>```

Evaluation with sklearn:

```<code>from sklearn.metrics import roc_auc_score

pred = model.predict(test_generator, verbose=0)

# Assign most probable label
predicted_class_indices = np.round(pred)

# Get AUC
roc_auc_score(test_generator.classes, predicted_class_indices)
</code>```

Body:
I am training a brain tumour classification model in Keras and I am interested in the AUC metric. By using keras model.evaluate with the test generator I obtain an AUC of 0.65 but, computing the AUC with sklearn roc_auc_score I obtain, 0.49, a completely different result (which does not make sense being less than 0.5) It does not make sense to me. Does it has an explanation or am I doing something wrong?

Model:

# Build model
base_model = VGG16(include_top=False, input_shape=(224, 224, 3), weights='imagenet')
base_model.trainable = False

inputs = keras.Input(shape=(224, 224, 3))
x = base_model(inputs, training=False)
# Convert features of shape `base_model.output_shape[1:]` to vectors
x = keras.layers.GlobalAveragePooling2D()(x)
# A Dense classifier for binary classification
x = keras.layers.Dense(128, activation='relu')(x)
x = keras.layers.Dense(64, activation='relu')(x)
x = keras.layers.Dense(32, activation='relu')(x)
outputs = keras.layers.Dense(1, activation='sigmoid')(x)
model = keras.Model(inputs, outputs)
model.summary()

Compile:

from tensorflow.keras.metrics import AUC

# Configure the model for training.
model.compile(optimizer=fit_optimizer, loss=loss_function, metrics=['accuracy', AUC()])

Evaluation with Keras:

# Evaluate the model
test_generator.reset()
score = model.evaluate(test_generator, verbose=0)

print(f"Loss: {str(score[0])} \nAccuracy on test: {str(score[1])}\n AUC: {str(score[2])}")

Evaluation with sklearn:

from sklearn.metrics import roc_auc_score

pred = model.predict(test_generator, verbose=0)

# Assign most probable label
predicted_class_indices = np.round(pred)

# Get AUC
roc_auc_score(test_generator.classes, predicted_class_indices)


问:
Blazor WASM Passing value from server to the client dynamically
I've made an application with Blazor WebAssembly with a 5min timer in a BackgroundService into my SERVER.
Now, everytime a second change I would like to notify my client to update the timer on the CLIENT page. (it's a Component)

I was wondering if there was a solution to call a CLIENT C# Method from my SERVER by using a SERVICE between this two ?

Do you have any suggestion ?

I've already created the shared SERVICE but I don't know how I can call my CLIENT C# method from my Service automatically.

ps : I've already trying to pass my values from my SERVER to a SERVICE who call a JAVASCRIPT function (with IJSRuntime) who will call my C# function to update the timer. But actually my Js function seems to not working.

[My Background Task]

`

```<code>// A 5min timer who create a Draw every 5min and update it when count is at 0
        public async Task ClockCountDownAsync()
        {
            if (secTime == 0 && minTime != 0)
            {
                if (minTime == 5)
                {
                    Draw newDraw = new Draw();
                    _unitOfWork.Draws.Add(newDraw);
                    await _unitOfWork.Complete();
                }
                minTime = minTime - 1;
                secTime = 59;
            }
            else if (secTime != 0)
            {
                secTime = secTime - 1;
            }
            else if(minTime == 0 && secTime == 0)
            {
                await DrawAndAddNumbers();
                minTime = 5;
                secTime = 0;
            }
            int[] timeTab = new int[] { minTime, secTime };

            _timerService.GetTimeFromCounter(timeTab);

        }
</code>```

`

[My Client Function]

`

```<code>public async Task UpdateTimer(int[] timeTab)
    {
        minTime = timeTab[0];
        secTime = timeTab[1];

        await InvokeAsync(StateHasChanged);
    }
</code>```

`

[The function in a Service shared who is called by the SERVER who need to call the function from my CLIENT]

`

```<code>public void GetTimeFromCounter(int[] timeTab)
        {
            // UpdateTimer(timeTab);

        }
</code>```

`

Body:
I've made an application with Blazor WebAssembly with a 5min timer in a BackgroundService into my SERVER.
Now, everytime a second change I would like to notify my client to update the timer on the CLIENT page. (it's a Component)

I was wondering if there was a solution to call a CLIENT C# Method from my SERVER by using a SERVICE between this two ?

Do you have any suggestion ?

I've already created the shared SERVICE but I don't know how I can call my CLIENT C# method from my Service automatically.

ps : I've already trying to pass my values from my SERVER to a SERVICE who call a JAVASCRIPT function (with IJSRuntime) who will call my C# function to update the timer. But actually my Js function seems to not working.

[My Background Task]

`

// A 5min timer who create a Draw every 5min and update it when count is at 0
        public async Task ClockCountDownAsync()
        {
            if (secTime == 0 && minTime != 0)
            {
                if (minTime == 5)
                {
                    Draw newDraw = new Draw();
                    _unitOfWork.Draws.Add(newDraw);
                    await _unitOfWork.Complete();
                }
                minTime = minTime - 1;
                secTime = 59;
            }
            else if (secTime != 0)
            {
                secTime = secTime - 1;
            }
            else if(minTime == 0 && secTime == 0)
            {
                await DrawAndAddNumbers();
                minTime = 5;
                secTime = 0;
            }
            int[] timeTab = new int[] { minTime, secTime };

            _timerService.GetTimeFromCounter(timeTab);

        }

`

[My Client Function]

`

public async Task UpdateTimer(int[] timeTab)
    {
        minTime = timeTab[0];
        secTime = timeTab[1];

        await InvokeAsync(StateHasChanged);
    }

`

[The function in a Service shared who is called by the SERVER who need to call the function from my CLIENT]

`

public void GetTimeFromCounter(int[] timeTab)
        {
            // UpdateTimer(timeTab);

        }

`


问:
Manage modular features on Android application
I have an application with some dynamic features and I would like to know if is's possible to ONLY update the features and not the base application on the Play Store. Indeed, I don't want to have to upgrade the version code every time.

Example :
I have a base application with a splah screen, a Login screen and a home screen where we can launch some features, and I have feature A, B and C. The .aab is on the Play Store and accessible to users.
If I update feature B and C or I add other features, do I have to re-upload the whole .aab including the base project and the 3 features, plus upgrade the version code? Is there a way to only deploy the updated feature modules without having to redeploy the whole .aab?

I tried Play Feature Delivery with onDemand Module and In-App Update. That help but it's not really what's I want because onDemand Module is just to manage our features inside the app bundle but it doesn't allow to update a module independently of the core app. The In-App Update is just a way to "force" the user to update the application.


问:
Apache Require all granted in general config file
im trying to configure the access for a subdirectory in my virtual host.

After some try and error i got to the conclusion that the directive Require all granted over the /var/www directory in the apache.conf file is applying to my specific virtual host configuration file, where i use Require valid-user.

So when i request the file the server applies both Require clauses and do an require any operation over them, so the Require all granted makes all users authorized to see the resource, even when i specified a restriction in the specific config file for my virtual host.

Is there any way to override this behaviour without touching the general config file?
I want to keep the Require all granted an AllowOverride None over the /var/www folder.
Thank you.

/etc/apache2/apache2.conf

Thats the file with the AllowOverride none and the Require all granted.


问:
swift: EXC_BAD_ACCESS with using Realm and FolioReaderKit
I installed FolioReaderKit using Cocoapods to read epub book. I'm trying to highlight text and add it to a list of highlights. But when I do this I get this error and my app crashes:

Thread 1: EXC_BAD_ACCESS (code=257, address=0x41c4a1c96ae55d46)

line:

```<code>value = RLMGetOptional(static_cast<RLMOptionalBase *>(object_getIvar(obj, prop.swiftIvar)));
</code>```

in RLMAccessor.mm:

```<code>id RLMAccessorContext::propertyValue(__unsafe_unretained id const obj, size_t propIndex,
                                     __unsafe_unretained RLMProperty *const prop) {
    // Property value from an NSArray
    if ([obj respondsToSelector:@selector(objectAtIndex:)]) {
        return propIndex < [obj count] ? [obj objectAtIndex:propIndex] : nil;
    }

    // Property value from an NSDictionary
    if ([obj respondsToSelector:@selector(objectForKey:)]) {
        return [obj objectForKey:prop.name];
    }

    // Property value from an instance of this object type
    id value;
    if ([obj isKindOfClass:_info.rlmObjectSchema.objectClass] && prop.swiftIvar) {
        if (prop.array) {
            return static_cast<RLMListBase *>(object_getIvar(obj, prop.swiftIvar))._rlmArray;
        }
        else if (prop.swiftIvar == RLMDummySwiftIvar) {
            // FIXME: An invalid property which we're pretending is nil until 4.0
            // https://github.com/realm/realm-cocoa/issues/5784
            return NSNull.null;
        }
        else { // optional
            value = RLMGetOptional(static_cast<RLMOptionalBase *>(object_getIvar(obj, prop.swiftIvar)));
        }
    }
    else {
    // Property value from some object that's KVC-compatible
        value = RLMValidatedValueForProperty(obj, [obj respondsToSelector:prop.getterSel] ? prop.getterName : prop.name,
                                             _info.rlmObjectSchema.className);
    }
    return value ?: NSNull.null;
}
</code>```

How to fix it?

Body:
I installed FolioReaderKit using Cocoapods to read epub book. I'm trying to highlight text and add it to a list of highlights. But when I do this I get this error and my app crashes:

Thread 1: EXC_BAD_ACCESS (code=257, address=0x41c4a1c96ae55d46)

line:

value = RLMGetOptional(static_cast<RLMOptionalBase *>(object_getIvar(obj, prop.swiftIvar)));

in RLMAccessor.mm:

id RLMAccessorContext::propertyValue(__unsafe_unretained id const obj, size_t propIndex,
                                     __unsafe_unretained RLMProperty *const prop) {
    // Property value from an NSArray
    if ([obj respondsToSelector:@selector(objectAtIndex:)]) {
        return propIndex < [obj count] ? [obj objectAtIndex:propIndex] : nil;
    }

    // Property value from an NSDictionary
    if ([obj respondsToSelector:@selector(objectForKey:)]) {
        return [obj objectForKey:prop.name];
    }

    // Property value from an instance of this object type
    id value;
    if ([obj isKindOfClass:_info.rlmObjectSchema.objectClass] && prop.swiftIvar) {
        if (prop.array) {
            return static_cast<RLMListBase *>(object_getIvar(obj, prop.swiftIvar))._rlmArray;
        }
        else if (prop.swiftIvar == RLMDummySwiftIvar) {
            // FIXME: An invalid property which we're pretending is nil until 4.0
            // https://github.com/realm/realm-cocoa/issues/5784
            return NSNull.null;
        }
        else { // optional
            value = RLMGetOptional(static_cast<RLMOptionalBase *>(object_getIvar(obj, prop.swiftIvar)));
        }
    }
    else {
    // Property value from some object that's KVC-compatible
        value = RLMValidatedValueForProperty(obj, [obj respondsToSelector:prop.getterSel] ? prop.getterName : prop.name,
                                             _info.rlmObjectSchema.className);
    }
    return value ?: NSNull.null;
}

How to fix it?


问:
How can I run more than standard docker-compose instances on my server?
I'm trying to run multiple instances of a docker-compose app (4 containers) on a VM (8 CPU-cores, 32 GB RAM, 1TB SSD, Ubuntu 20.04 LTS on Virtuozzo Platform). A single nginx-container is doing the reverse-proxy up front. All containers run under a single user 1000/1000.

Basic procedure is to copy the directories from a template, set the params for the instance, cd into the new directory and start with

```<code>docker compose up -d
</code>```

This works perfectly fine for 6 instances and the proxy (25 containers).

Problem: When I try to set up the 7th instance docker won't start that one with different error messages starting always with:

```<code>Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: [...]
</code>```

One or two containers might be created but not all four for the instance.

When I take down another instance I can start the new instance without problems.

I tried to assign a non-default network with static IP addresses to each container and it works well but doesn't solve the problem.

```<code>[...]
networks:
  net:
    driver: bridge
    ipam:
      driver: default
      config:
      - subnet: 10.0.111.0/24

services:
[...]
</code>```

Three days of searching so and the web took me to various system-limits but none applied here.
I even took a chance with docker swarm which doesn't apply here (other purpose).

I would be thankful for any hint that points me in the right direction.

Body:
I'm trying to run multiple instances of a docker-compose app (4 containers) on a VM (8 CPU-cores, 32 GB RAM, 1TB SSD, Ubuntu 20.04 LTS on Virtuozzo Platform). A single nginx-container is doing the reverse-proxy up front. All containers run under a single user 1000/1000.

Basic procedure is to copy the directories from a template, set the params for the instance, cd into the new directory and start with

docker compose up -d

This works perfectly fine for 6 instances and the proxy (25 containers).

Problem: When I try to set up the 7th instance docker won't start that one with different error messages starting always with:

Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: [...]

One or two containers might be created but not all four for the instance.

When I take down another instance I can start the new instance without problems.

I tried to assign a non-default network with static IP addresses to each container and it works well but doesn't solve the problem.

[...]
networks:
  net:
    driver: bridge
    ipam:
      driver: default
      config:
      - subnet: 10.0.111.0/24

services:
[...]

Three days of searching so and the web took me to various system-limits but none applied here.
I even took a chance with docker swarm which doesn't apply here (other purpose).

I would be thankful for any hint that points me in the right direction.


问:
I want to host a project on GitHub but the index.html file is present in many sub-folders
Well I am new to hosting websites on GitHub, I tried hosting few of the basic project on GitHub and they worked very well. Basically for this project I was assigned to host a website provide by Guide and that has the index.html file present in \public\fonts\icomoon.index.html.

I still haven't tried moving the index.html in the main folder but is their any other way to do it without moving the index.html file.


问:
whatsapp contact list with photos show in tableview/Swift
How can I show the photos and names of people in whatsapp in tableview in my swift application? do i need to use api for this or is there any other way?</p>


问:
How to keep React-Bootstrap Popovers on-screen in Bootstrap v5/React-Bootstrap v2.5?
I have elements which have exactly enough width to reach the right edge of the window.  Previously, when hovering over one of these elements, a popover appears which extends to the right but is shifted left so that it remains on-screen.

Now, I'm updating my dependencies from Bootstrap 4.3.1 to 5.2.2 and from React-Bootstrap 1.0.0-beta.12 to 2.5.0.  Now when I hover an element, the popover appears at the right end of the element, which places it exactly offscreen, causing a scrollbar to appear, etc.

```<code><OverlayTrigger placement='right'
                overlay={<Popover>
                             <Popover.Body>
                                 {content}
                             </Popover.Body>
                         </Popover>}>
    <Element />
</OverlayTrigger>
</code>```

It's not a CSS issue.  Inspecting the popover in devtools, the only thing that matters is the dynamically calculated transform property.  I assume there must be a setting or configuration responsible for the behavior I'm looking for, but I can't find any hint of that.

I've attempted to use the popperConfig attribute, but nothing I do with it seems to accomplish anything.  My attempt looks like this:

```<code>popperConfig={{
    modifiers: [
        {
            name: 'preventOverflow',
            enabled: true
        }
    ]
}}
</code>```

with variations on boundary options as well.

MRE (old):

Packages used are:

```<code>"react": "^16.8.0",
"react-dom": "^16.8.0",
"bootstrap": "^4.3.1",
"react-bootstrap": "^1.0.0-beta.12",
</code>```

Create index.js with the following:

```<code>import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.min.css';
import {OverlayTrigger, Popover} from "react-bootstrap/index";

class App extends React.Component {
    constructor(props) {
        super(props);

    }
    render() {
        return (
            <div>
                <OverlayTrigger placement="right"
                                overlay={<Popover>
                                    <Popover.Content>
                                        content
                                    </Popover.Content>
                                </Popover>}>
                    <div style={{width: '100%', height: '50px', background: 'blue', marginTop: '50px'}}></div>
                </OverlayTrigger>
            </div>
        )
    }
}

ReactDOM.render(<App/>, document.getElementById('root'));
</code>```

MRE (new):

Packages used are:

```<code>"react": "^16.8.0",
"react-dom": "^16.8.0",
"bootstrap": "^5.2.2",
"react-bootstrap": "^2.5.0",
</code>```

Create index.js with the following:

```<code>import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.min.css';
import {OverlayTrigger, Popover} from "react-bootstrap";

class App extends React.Component {
    constructor(props) {
        super(props);

    }
    render() {
        return (
            <div>
                <OverlayTrigger placement="right"
                                overlay={<Popover>
                                    <Popover.Body>
                                        content
                                    </Popover.Body>
                                </Popover>}>
                    <div style={{width: '100%', height: '50px', background: 'blue', marginTop: '50px'}}></div>
                </OverlayTrigger>
            </div>
        )
    }
}

ReactDOM.render(<App/>, document.getElementById('root'));
</code>```

Body:
I have elements which have exactly enough width to reach the right edge of the window.  Previously, when hovering over one of these elements, a popover appears which extends to the right but is shifted left so that it remains on-screen.

Now, I'm updating my dependencies from Bootstrap 4.3.1 to 5.2.2 and from React-Bootstrap 1.0.0-beta.12 to 2.5.0.  Now when I hover an element, the popover appears at the right end of the element, which places it exactly offscreen, causing a scrollbar to appear, etc.

<OverlayTrigger placement='right'
                overlay={<Popover>
                             <Popover.Body>
                                 {content}
                             </Popover.Body>
                         </Popover>}>
    <Element />
</OverlayTrigger>

It's not a CSS issue.  Inspecting the popover in devtools, the only thing that matters is the dynamically calculated transform property.  I assume there must be a setting or configuration responsible for the behavior I'm looking for, but I can't find any hint of that.

I've attempted to use the popperConfig attribute, but nothing I do with it seems to accomplish anything.  My attempt looks like this:

popperConfig={{
    modifiers: [
        {
            name: 'preventOverflow',
            enabled: true
        }
    ]
}}

with variations on boundary options as well.

MRE (old):

Packages used are:

"react": "^16.8.0",
"react-dom": "^16.8.0",
"bootstrap": "^4.3.1",
"react-bootstrap": "^1.0.0-beta.12",

Create index.js with the following:

import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.min.css';
import {OverlayTrigger, Popover} from "react-bootstrap/index";

class App extends React.Component {
    constructor(props) {
        super(props);

    }
    render() {
        return (

                <OverlayTrigger placement="right"
                                overlay={<Popover>
                                    <Popover.Content>
                                        content
                                    </Popover.Content>
                                </Popover>}>

                </OverlayTrigger>

        )
    }
}

ReactDOM.render(<App/>, document.getElementById('root'));

MRE (new):

Packages used are:

"react": "^16.8.0",
"react-dom": "^16.8.0",
"bootstrap": "^5.2.2",
"react-bootstrap": "^2.5.0",

Create index.js with the following:

import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.min.css';
import {OverlayTrigger, Popover} from "react-bootstrap";

class App extends React.Component {
    constructor(props) {
        super(props);

    }
    render() {
        return (

                <OverlayTrigger placement="right"
                                overlay={<Popover>
                                    <Popover.Body>
                                        content
                                    </Popover.Body>
                                </Popover>}>

                </OverlayTrigger>

        )
    }
}

ReactDOM.render(<App/>, document.getElementById('root'));


问:
Struggling with typing an object, with computed property keys
I'm struggling to correctly type the endpointMeta object in my project.
It contains computed object keys that are related to 2 objects

services - contains the names of the services currently known. The number of services may increase later.

endpoints - define the endpoints available in the service, that are being called in the project.

```<code>enum services {
    serviceNameOne = 'service1',
    serviceNameTwo = 'service2',
    serviceNameThree = 'service3',
};

const endpoints = {
    [services.serviceNameOne]: {
        getUser: '/getUser',
        verifyDetails: '/s/verifyDetails',
    },
    [services.serviceNameTwo]: {
        fetchCustomersv1: '/v1/fetchCustomers',
        fetchCustomersv2: '/v2/fetchCustomersv1',
    },
    [services.serviceNameThree]: {
        getAllProjects: '/g/a/p',
        getProject: '/g/p',
        updateProject: '/u/p',
    }
}
</code>```

endpointMeta - object contains some meta info about these endpoints

```<code>const endpointMeta = {
    [services.serviceNameOne]:{
        [endpoints.serviceOne.getUser]: {
            description: 'something about getUser',
            version: 1
        },
        [endpoints.serviceOne.verifyDetails]:{
            description: 'something about verifyDetails',
            version: 3
        },
    },
    [services.serviceNameTwo]:{
        [endpoints.serviceTwo.fetchCustomersv1]: {
            description: 'something about fetchCustomersv1',
            version: 1
        },
        [endpoints.serviceTwo.fetchCustomersv1]:{ // duplicate object :(
            description: 'something about fetchCustomersv1',
            version: 1
        },
    }

}

</code>```

Edit

What I ideally want is for when other devs are introducing new services or endpoints, they should be forced to add an entry to the endpointmeta object.

TS Playground

Body:
I'm struggling to correctly type the endpointMeta object in my project.
It contains computed object keys that are related to 2 objects

services - contains the names of the services currently known. The number of services may increase later.

endpoints - define the endpoints available in the service, that are being called in the project.

enum services {
    serviceNameOne = 'service1',
    serviceNameTwo = 'service2',
    serviceNameThree = 'service3',
};

const endpoints = {
    [services.serviceNameOne]: {
        getUser: '/getUser',
        verifyDetails: '/s/verifyDetails',
    },
    [services.serviceNameTwo]: {
        fetchCustomersv1: '/v1/fetchCustomers',
        fetchCustomersv2: '/v2/fetchCustomersv1',
    },
    [services.serviceNameThree]: {
        getAllProjects: '/g/a/p',
        getProject: '/g/p',
        updateProject: '/u/p',
    }
}

endpointMeta - object contains some meta info about these endpoints

const endpointMeta = {
    [services.serviceNameOne]:{
        [endpoints.serviceOne.getUser]: {
            description: 'something about getUser',
            version: 1
        },
        [endpoints.serviceOne.verifyDetails]:{
            description: 'something about verifyDetails',
            version: 3
        },
    },
    [services.serviceNameTwo]:{
        [endpoints.serviceTwo.fetchCustomersv1]: {
            description: 'something about fetchCustomersv1',
            version: 1
        },
        [endpoints.serviceTwo.fetchCustomersv1]:{ // duplicate object :(
            description: 'something about fetchCustomersv1',
            version: 1
        },
    }

}

Edit

What I ideally want is for when other devs are introducing new services or endpoints, they should be forced to add an entry to the endpointmeta object.

<a href="https://www.typescriptlang.org/play?ssl=69&ssc=1&pln=46&pc=1#code/KYOwrgtgBAzsBOA3AlgY2DKBvAsAKCkNgRXQDkBDCYAeRGCgF4oByOJNW+lgGnyOIdyVYABUA7gHsmrdqTFTe-InM6VqogBbxgDZmxKctO4ErwBfANz58AeltQALgE8ADg1EBlQ+kzMA1sDOkgBmTm7AoYLyMNZ4Nnj24e5QogCiIAAmrpLIII4yuIkOAgDagc5QeaneQhhQFJgABqWqvgB0ACRYFeYAuk19AFzYdiUCROVBAEwjMI7weQDmwxQgzmMT5pvb8cXJHhnZufnThZtlbRjtV+pcwMNQAErAqJLwmQA884sgSzw-ZYAPh2CQSbxA8ygoGOeUcflGBEmVxgNx8wDudAeIyKEyIS2AjgAquwRixbATiewzHjCIgEMgQs4ACKEijIAA2MDJthgtnpiyZrMc7K5NKI5j4SMIrXRqNuIgkkkeuNpIUJqE0AGEwPNJNR4DBEABGHkm2zqxyanV6g0wcV4y3W3WOfUII2zVj86YWjXal1uw0mh1QSXKGUotF1O7GXQq8MTSkAQQ5HIACvBJAArV7wnlLWwUWyuEMCSkZ7O5-PF0tEMCuTIURzACs51COHlgGtSgS7XabFwpJYyNIADwWFHbn0HkTCMJycJgPFgC2BYL2SRnqSOC-yAFk2ed9mV-FUQDU5Y8wCB-CBJOIQKC9hCofOTo4DyKj5c5VH5Jj6GGVU8VKN9Fz-TgsXaSkSQQeNpVpQhMgwVBFlcRxkEkEAyRgN1HE0ZYGgAI0kMAChg6ke0QogBRgTDsKgY0E17KiQLA-J5XRKCBUZFk2U5GAgOY2lkJgVDkHQ+icLwgi-mI0iCh4oV+LFVjqNoqSoAAZmEwgwwQ-SfzqTjo0VKQhIQsp2PhCD0CVdonX9W13RNeDqKIUTxMkrDpOofDCIoEiyKgRybVdO1gzUxCNJ8xjdNDKLJmskz5Hs0KAwi40gKgJJMnrDk0CbBhJCItsCiGAAKeKBE8tCMNitgZICoKCnS5yg2NWs8RihimMsiU1P7Cx8CAA" rel="nofollow noreferrer">TS Playground


问:
Identiying elements in a page
My page has a form and a table.
When post this form (A), filter some data and display in the table via ajax.

Some form fields open a telerik window that has a form(B) and table. In this window when sending the form is filling the table of form A.
This is because my javascript do something like this:

```<code> $.post(this.href,
        serializedForm,
        function (response) {
            $("#grid-result").html(response);
        });
</code>```

All grid has the same id. I know that this is a problem, but there is an indirect way to reach the grid ?

ContentLicense: CC BY-SA 3.0

Title: Identiying elements in a page

Body:
My page has a form and a table.
When post this form (A), filter some data and display in the table via ajax.

Some form fields open a telerik window that has a form(B) and table. In this window when sending the form is filling the table of form A.
This is because my javascript do something like this:

 $.post(this.href,
        serializedForm,
        function (response) {
            $("#grid-result").html(response);
        });

All grid has the same id. I know that this is a problem, but there is an indirect way to reach the grid ?


问:
Django CoInitialize has not been called
I am trying to automate outlook, using python Django.
the code works pretty good directly using python, but when using it in my Django app it gives me this error.

```<code>> pywintypes.com_error: (-2147221008, 'CoInitialize has not been called.', None, None)
</code>```

and my views code is :

```<code>import win32com.client as win32
 def about(request):
    olApp = win32.Dispatch('Outlook.Application')
    olNS = olApp.GetNameSpace('MAPI')
    inbox = olNS.GetDefaultFolder(6)
    messages = inbox.Items
    for msg in messages:
           if msg.Class==43:
               if msg.SenderEmailType=='EX':
                   print(1,msg.Sender.GetExchangeUser().PrimarySmtpAddress)
               else:
                   print(2, msg.SenderEmailAddress)
    return render(request,'Home/About.html')
</code>```

So any suggestion to solve this problem?

Title: Django CoInitialize has not been called

Body:
I am trying to automate outlook, using python Django.
the code works pretty good directly using python, but when using it in my Django app it gives me this error.

> pywintypes.com_error: (-2147221008, 'CoInitialize has not been called.', None, None)

and my views code is :

import win32com.client as win32
 def about(request):
    olApp = win32.Dispatch('Outlook.Application')
    olNS = olApp.GetNameSpace('MAPI')
    inbox = olNS.GetDefaultFolder(6)
    messages = inbox.Items
    for msg in messages:
           if msg.Class==43:
               if msg.SenderEmailType=='EX':
                   print(1,msg.Sender.GetExchangeUser().PrimarySmtpAddress)
               else:
                   print(2, msg.SenderEmailAddress)
    return render(request,'Home/About.html')

So any suggestion to solve this problem?


问:
Filtering query from database
I have a problem because I am new to mongodb and c#. I hope you can help.

I need to add a filter when retrieving data from database. Objects in ProductAttributeCombinations in the database exist more than once. I'm getting data from these objects to the variable named ProductAttributeText, but it comes as a list because there is more than one data in the object. What I need to do is to compare the value under a different object in the database with the values under this object and get the data accordingly.

My codes where I get the data

```<code>var querySpec = await _productRepository.Collection
                    .Aggregate()
                    .Unwind(x => x.ProductAttributeMappings)
                    .Project(new BsonDocument {
                            { "ProductAttributeId", "$ProductAttributeMappings.ProductAttributeId" },
                            { "ProductAttributeValues","$ProductAttributeMappings.ProductAttributeValues.Name" },
                            { "ProductAttributeCombination","$ProductAttributeCombinations.Text" },

                    })
                    .Unwind("ProductAttributeValues")
                    .Group(new BsonDocument {
                        {"_id",
                            new BsonDocument {
                                { "ProductAttributeId", "$ProductAttributeId" },
                                { "ProductAttributeName", "$ProductAttributeValues" },
                                { "ProductAttributeText", "$ProductAttributeCombination" },

                            }
                        },
                        {"count",
                            new BsonDocument {
                                { "$sum" , 1}
                            }
                        }
                    }).ToListAsync();
</code>```

If one of the list elements returned to me is like this

```<code>{{ "_id" : { "ProductAttributeId" : "60daf1f56b2621a0b7942eac", "ProductAttributeName" : "50", "ProductAttributeText" : ["30", "30", "30", "3", "3", "3", "30", "30", "30"] }, "count" : 3 }}
</code>```

When I add the filtering like this and add it as Match(filterAttr) to my code, QuerySpec returns null. Am I making a mistake in filtering?

```<code>var filterDefAttr = new FilterDefinitionBuilder<BsonDocument>();
            var filterAttr = (filterDefAttr.Eq("ProductAttributeCombinations.Attributes.Value", "ProductAttributeMappings.ProductAttributeValues._id"));
</code>```

Title: Filtering query from database

Body:
I have a problem because I am new to mongodb and c#. I hope you can help.

I need to add a filter when retrieving data from database. Objects in ProductAttributeCombinations in the database exist more than once. I'm getting data from these objects to the variable named ProductAttributeText, but it comes as a list because there is more than one data in the object. What I need to do is to compare the value under a different object in the database with the values under this object and get the data accordingly.

My codes where I get the data

var querySpec = await _productRepository.Collection
                    .Aggregate()
                    .Unwind(x => x.ProductAttributeMappings)
                    .Project(new BsonDocument {
                            { "ProductAttributeId", "$ProductAttributeMappings.ProductAttributeId" },
                            { "ProductAttributeValues","$ProductAttributeMappings.ProductAttributeValues.Name" },
                            { "ProductAttributeCombination","$ProductAttributeCombinations.Text" },

                    })
                    .Unwind("ProductAttributeValues")
                    .Group(new BsonDocument {
                        {"_id",
                            new BsonDocument {
                                { "ProductAttributeId", "$ProductAttributeId" },
                                { "ProductAttributeName", "$ProductAttributeValues" },
                                { "ProductAttributeText", "$ProductAttributeCombination" },

                            }
                        },
                        {"count",
                            new BsonDocument {
                                { "$sum" , 1}
                            }
                        }
                    }).ToListAsync();

If one of the list elements returned to me is like this

{{ "_id" : { "ProductAttributeId" : "60daf1f56b2621a0b7942eac", "ProductAttributeName" : "50", "ProductAttributeText" : ["30", "30", "30", "3", "3", "3", "30", "30", "30"] }, "count" : 3 }}

When I add the filtering like this and add it as Match(filterAttr) to my code, QuerySpec returns null. Am I making a mistake in filtering?

var filterDefAttr = new FilterDefinitionBuilder<BsonDocument>();
            var filterAttr = (filterDefAttr.Eq("ProductAttributeCombinations.Attributes.Value", "ProductAttributeMappings.ProductAttributeValues._id"));


问:
How to use Image.network() for private Image on google Drive
I am using Image.network(URL) for displaying images from Google Drive.
Works fine if the Link is public (accessible to everybody).
But if the Link has restrictions the Image is not loaded.
The working link format is as follows:

https://drive.google.com/uc?export=view&id=MYFOTOID

Does anybody know what is the correct format for a Private Foto?
I have already an API key available

&key=BLABLABLA......

but after several efforts I still cannot figure out the correct request format,
Can anybody help?