问:
Nextjs Images look FRIED with fill settings
I am attempting to make profile cards. When I use fill/contain, the images look great but are not filling the circular div:

And when I use fill/cover, they are the circular profile pics I want but the images themselves look a bit fried. Adding the unoptimized parameter did not help.

What would be the best way to solve this? Thank you so much!

```<code>                        {image ?
                                <Image
                                    loader={myLoader}
                                    className={'profileImage'}
                                    src={profileImage}
                                    alt={'Profile picture of ' + profile.fields.Name}
                                    layout={'fill'}
                                    objectFit={'contain'}
                                    unoptimized={false}
                                    quality={100}
                                    loading={"eager"}
                                    priority = {index < 10 ? true : false}
                                />
                            :
                            <div className="avatarWrapper ">
                                <Avatar
                                    size={'12vh'}
                                    ...
</code>```

Body:
I am attempting to make profile cards. When I use fill/contain, the images look great but are not filling the circular div:

And when I use fill/cover, they are the circular profile pics I want but the images themselves look a bit fried. Adding the unoptimized parameter did not help.

What would be the best way to solve this? Thank you so much!

                        {image ?
                                <Image
                                    loader={myLoader}
                                    className={'profileImage'}
                                    src={profileImage}
                                    alt={'Profile picture of ' + profile.fields.Name}
                                    layout={'fill'}
                                    objectFit={'contain'}
                                    unoptimized={false}
                                    quality={100}
                                    loading={"eager"}
                                    priority = {index < 10 ? true : false}
                                />
                            :

                                <Avatar
                                    size={'12vh'}
                                    ...


来源: stackexchange

问:
Create per configuration settings.json for vscode, similar to visual studio
I'm looking to move over to vs code from visual studio.

Is it possible to have a different settings.json per configuration, similar to the way  visual studio has properties per configuration (Release, Debug etc).

It appears this behaviour is available in the C++ extension configuration (c_cpp_properties.json) and the configuration is selectable in the status bar, however this is separate from the launch.json and other settings.

My goal is to be able to select configuration and have a different vscode and extension settings loaded.

ContentLicense: CC BY-SA 4.0


问:
Importing multiple log event types into pandas dataframe(s) strategy
I have some log events in a text file that has fields separated by commas, but the fields are different depending on the event type, and there is no header.

Here is an example:

```<code>EVENT_A, john, 321, abc, def
EVENT_B, jane, rty, 456, asd, def, 123
EVENT_C, joe, rick
</code>```

Each event type will always have the same field names that I would like to supply, but each event types fields don't necessarily line up with the other event fields even though they share some of the same field names. The first field however, is always the event type.

I'm considering figuring out a way to include everything in one dataframe, or have multiple dataframes that i can join as needed.

In either case what's the most efficient way to parse this?

Body:
I have some log events in a text file that has fields separated by commas, but the fields are different depending on the event type, and there is no header.

Here is an example:

EVENT_A, john, 321, abc, def
EVENT_B, jane, rty, 456, asd, def, 123
EVENT_C, joe, rick

Each event type will always have the same field names that I would like to supply, but each event types fields don't necessarily line up with the other event fields even though they share some of the same field names. The first field however, is always the event type.

I'm considering figuring out a way to include everything in one dataframe, or have multiple dataframes that i can join as needed.

In either case what's the most efficient way to parse this?


问:
ValueError: operands could not be broadcast together with shapes (3,) (1000,), Python
```<code>import numpy as np
import math
from sympy import*

a = 1.0
b = 4.0
N = 1000
x = np.linspace(a,b,N)
y=(np.sin(3*x),(x,1,4));
integral = 0.0
for k in range(len(x) - 1):
    integral +=0.5*((x[k+1]-x[k])*(y[k+1]+y[k]))
print(integral)
</code>```

I want to calculate the ingretal with trapezoidal method but still ocorring this error: ValueError: operands could not be broadcast together with shapes (3,) (1000,).

Please help me!

Body:
import numpy as np
import math
from sympy import*

a = 1.0
b = 4.0
N = 1000
x = np.linspace(a,b,N)
y=(np.sin(3*x),(x,1,4));
integral = 0.0
for k in range(len(x) - 1):
    integral +=0.5*((x[k+1]-x[k])*(y[k+1]+y[k]))
print(integral)

I want to calculate the ingretal with trapezoidal method but still ocorring this error: ValueError: operands could not be broadcast together with shapes (3,) (1000,).

Please help me!


问:
Flutter How can i lift values from a Multi Screen SignUp Form using Provider
i working on a project which contains a **signup **form containing multi pages each input needed in the signup have its own page for example (email , city , first , password , user inputed images , interests , additional info , description )
i want to have this values whenever he inputs one and have them all using **provider **then post them with and **HttpPost **method
here are some pics to understand the Ui more

[to uderstand more how its gonna be ](https://i.stack.imgur.com/IYtfg.png[enter image description here](https://i.stack.imgur.com/19ZLg.png))

i'm new to provider and i dont know how to get these values from each screen into one then post them

i'm beggining to try on these but i dont find any good resource on this because most of apps nowadays dont use mutiple screens in order to signUp


问:
adding multiple EBS_block_devices to using ec2 module
I am trying to create a module to with the following:

```<code>            resource "aws_instance" "ec2" {
                ami = "ami-0d729a60"
                instance_type = "t2.micro"

                ebs_block_device {
                  device_name = "/some/name"
                  volume_size = "10"
                  volume_type = "gp2"
                  encrypted = false
            }

                ebs_block_device {
                  device_name = "/some/name1"
                  volume_size = "10"
                  volume_type = "gp2"
                  encrypted = false
            }

            }
</code>```

This resource block populates the 2 ebs_block_devices with terraform plan.

```<code>              + ebs_block_device {
                  + delete_on_termination = true
                  + device_name           = "/some/name"
                  + encrypted             = false
                  + iops                  = (known after apply)
                  + kms_key_id            = (known after apply)
                  + snapshot_id           = (known after apply)
                  + throughput            = (known after apply)
                  + volume_id             = (known after apply)
                  + volume_size           = 10
                  + volume_type           = "gp2"
                }
              + ebs_block_device {
                  + delete_on_termination = true
                  + device_name           = "/some/name1"
                  + encrypted             = false
                  + iops                  = (known after apply)
                  + kms_key_id            = (known after apply)
                  + snapshot_id           = (known after apply)
                  + throughput            = (known after apply)
                  + volume_id             = (known after apply)
                  + volume_size           = 10
                  + volume_type           = "gp2"
                }

</code>```

However when i try the below tf code, terraform plan only populates the first ebsvolume. i've also tried altering the second blocks variables (var.ebs_name1 etc)

```<code>                ebs_block_device {

                device_name           = var.ebs_name
                volume_size           = var.ebs_volume_size
                volume_type           = var.ebs_volume_type
                delete_on_termination = true
                encrypted             = false
              }
              ebs_block_device {
                device_name           = var.ebs_name
                volume_size           = var.ebs_volume_size
                volume_type           = var.ebs_volume_type
                delete_on_termination = true
                encrypted             = false
              }

</code>```

the error i received:

```<code>    ╷
    │ Error: Unsupported block type
    │
    │   on main.tf line 9, in module "ec2":
    │    9:   ebs_block_device {
    │
    │ Blocks of type "ebs_block_device" are not expected here.
    ╵
    ╷
    │ Error: Unsupported block type
    │
    │   on main.tf line 16, in module "ec2":
    │   16:   ebs_block_device {
    │
    │ Blocks of type "ebs_block_device" are not expected here.
</code>```

Body:
I am trying to create a module to with the following:

            resource "aws_instance" "ec2" {
                ami = "ami-0d729a60"
                instance_type = "t2.micro"

                ebs_block_device {
                  device_name = "/some/name"
                  volume_size = "10"
                  volume_type = "gp2"
                  encrypted = false
            }

                ebs_block_device {
                  device_name = "/some/name1"
                  volume_size = "10"
                  volume_type = "gp2"
                  encrypted = false
            }

            }

This resource block populates the 2 ebs_block_devices with terraform plan.

              + ebs_block_device {
                  + delete_on_termination = true
                  + device_name           = "/some/name"
                  + encrypted             = false
                  + iops                  = (known after apply)
                  + kms_key_id            = (known after apply)
                  + snapshot_id           = (known after apply)
                  + throughput            = (known after apply)
                  + volume_id             = (known after apply)
                  + volume_size           = 10
                  + volume_type           = "gp2"
                }
              + ebs_block_device {
                  + delete_on_termination = true
                  + device_name           = "/some/name1"
                  + encrypted             = false
                  + iops                  = (known after apply)
                  + kms_key_id            = (known after apply)
                  + snapshot_id           = (known after apply)
                  + throughput            = (known after apply)
                  + volume_id             = (known after apply)
                  + volume_size           = 10
                  + volume_type           = "gp2"
                }

However when i try the below tf code, terraform plan only populates the first ebsvolume. i've also tried altering the second blocks variables (var.ebs_name1 etc)

                ebs_block_device {

                device_name           = var.ebs_name
                volume_size           = var.ebs_volume_size
                volume_type           = var.ebs_volume_type
                delete_on_termination = true
                encrypted             = false
              }
              ebs_block_device {
                device_name           = var.ebs_name
                volume_size           = var.ebs_volume_size
                volume_type           = var.ebs_volume_type
                delete_on_termination = true
                encrypted             = false
              }

the error i received:

    ╷
    │ Error: Unsupported block type
    │
    │   on main.tf line 9, in module "ec2":
    │    9:   ebs_block_device {
    │
    │ Blocks of type "ebs_block_device" are not expected here.
    ╵
    ╷
    │ Error: Unsupported block type
    │
    │   on main.tf line 16, in module "ec2":
    │   16:   ebs_block_device {
    │
    │ Blocks of type "ebs_block_device" are not expected here.


问:
How do I make all layers to be activated automatically when added in QGIS
for some unknown reason, whenever I create or upload new layers to QGIS, the default is that the layers are always unmarked so they are deactivated. How do I change the settings that all new layers will be automatically be activated when uploaded ? enter image description here

I don't know what to try


问:
intern_profile_view() missing 1 required positional argument: 'request'
Can anyone tell me what I've done wrong? I'm trying to create a simple multi users app in django and I can't quite tell what I'm missing in my view.

Here's what I have so far.

views.py

```<code>@method_decorator([login_required, intern_required], name='dispatch')
def intern_profile_view(request):

  if request.method == 'POST':

    user_form = InternSignUpForm(request.POST, prefix='UF')
    profile_form = InternProfileForm(request.POST, prefix='PF')

    if user_form.is_valid() and profile_form.is_valid():
        user = user_form.save(commit=False)

        user.save()

        user.intern_profile.bio = profile_form.cleaned_data.get('bio')
        user.intern_profile.location = profile_form.cleaned_data.get('location')
        user.intern_profile.save()

    else:
        user_form = InternSignUpForm(prefix='UF')
        profile_form = InternProfileForm(prefix='PF')

    return render(request, 'interns/intern_profile.html',{
            'user_form': user_form,
            'profile_form': profile_form,
        })
</code>```

models.py

```<code>class User(AbstractUser):
    is_student = models.BooleanField(default=False)
    is_teacher = models.BooleanField(default=False)
    is_intern = models.BooleanField(default=False)

class InternProfile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, null=True,
           related_name='intern_profile')
    bio = models.CharField(max_length=30, blank=True)
    location = models.CharField(max_length=30, blank=True)
</code>```

traceback

```<code>Traceback (most recent call last):
  File "C:\Users\mikha\issue_env\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File "C:\Users\mikha\issue_env\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\mikha\issue_env\lib\site-packages\django\utils\decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
TypeError: intern_profile_view() missing 1 required positional argument: 'request'
</code>```

urls.py

```<code>path('interns/', include(([
        path('', interns.intern_profile_view, name='intern_profile'),
    ], 'classroom'), namespace='interns')),
</code>```

Body:
Can anyone tell me what I've done wrong? I'm trying to create a simple multi users app in django and I can't quite tell what I'm missing in my view.

Here's what I have so far.

views.py

@method_decorator([login_required, intern_required], name='dispatch')
def intern_profile_view(request):

  if request.method == 'POST':

    user_form = InternSignUpForm(request.POST, prefix='UF')
    profile_form = InternProfileForm(request.POST, prefix='PF')

    if user_form.is_valid() and profile_form.is_valid():
        user = user_form.save(commit=False)

        user.save()

        user.intern_profile.bio = profile_form.cleaned_data.get('bio')
        user.intern_profile.location = profile_form.cleaned_data.get('location')
        user.intern_profile.save()

    else:
        user_form = InternSignUpForm(prefix='UF')
        profile_form = InternProfileForm(prefix='PF')

    return render(request, 'interns/intern_profile.html',{
            'user_form': user_form,
            'profile_form': profile_form,
        })

models.py

class User(AbstractUser):
    is_student = models.BooleanField(default=False)
    is_teacher = models.BooleanField(default=False)
    is_intern = models.BooleanField(default=False)

class InternProfile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, null=True,
           related_name='intern_profile')
    bio = models.CharField(max_length=30, blank=True)
    location = models.CharField(max_length=30, blank=True)

traceback

Traceback (most recent call last):
  File "C:\Users\mikha\issue_env\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File "C:\Users\mikha\issue_env\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\mikha\issue_env\lib\site-packages\django\utils\decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
TypeError: intern_profile_view() missing 1 required positional argument: 'request'

urls.py

path('interns/', include(([
        path('', interns.intern_profile_view, name='intern_profile'),
    ], 'classroom'), namespace='interns')),


问:
How to get all permissions/policies for a AWS user?
I want to list all the policies/permissions an AWS User has

```<code>const allUsersPolicies = users.Users.map(async (user) => {

const userPolicies = await iam.listAttachedUserPolicies({ UserName: user.UserName }).promise();
  const inlinePolicies = await iam.listUserPolicies({ UserName: user.UserName }).promise();

  const listOfGroups = await iam.listGroupsForUser({ UserName: user.UserName }).promise();
 console.log(listOfGroups);
  return {
    user: user.UserName,
    attachedPolicies: userPolicies.AttachedPolicies.map((policy) => policy.PolicyName),
    inlinePolices: inlinePolicies.PolicyNames,
  };
});
</code>```

I've seen users have empty policies, but it could also inherit policies from a group and I would have to query that also

Am I going in the right direction?

I'm new to AWS coming from GCP

Body:
I want to list all the policies/permissions an AWS User has

const allUsersPolicies = users.Users.map(async (user) => {

const userPolicies = await iam.listAttachedUserPolicies({ UserName: user.UserName }).promise();
  const inlinePolicies = await iam.listUserPolicies({ UserName: user.UserName }).promise();

  const listOfGroups = await iam.listGroupsForUser({ UserName: user.UserName }).promise();
 console.log(listOfGroups);
  return {
    user: user.UserName,
    attachedPolicies: userPolicies.AttachedPolicies.map((policy) => policy.PolicyName),
    inlinePolices: inlinePolicies.PolicyNames,
  };
});

I've seen users have empty policies, but it could also inherit policies from a group and I would have to query that also

Am I going in the right direction?

I'm new to AWS coming from GCP


问:
Why is the border wider in Outlook client than in the web?
I am creating HTML template for Outlook and I want my 2 column table to have bottom borders on the columns like this, which I did by setting border-bottom property to the td element

Anyway, the picture is from the browser outlook, because when I open the client I see this .. as you can see the border of the last row is a single line, it's not split..to create a gap between the columns I use border-right: 25px solid white property.

Here is the situation with odd number of items [Img], (https://i.stack.imgur.com/231Af.png) I captured only the last 2 rows, but you can see the last item has a longer border than the upper ones. These tables are generated by code so all rows have the same properties, but still the last row makes the trouble.

The code is really long and messy, therefore I would like to ask without adding any code to the question. Do you have any ideas why this happens?

I have tried using a lot of CSS properties but none of them works.


问:
Cookie is not set in browser with express-session
Setup
I run two docker containers locally. One express backend and one next.js frontend. My database is on a remote server.

Backend snippet:

```<code>const corsOptions = {
    origin: '*',
    credentials: true,
};
app.use(cors(corsOptions));

app.use(express.static("public"));

app.use(express.json()); // lets us interpret(parse) post requests and returns an Object
app.use(express.urlencoded({ extended: true }));

// import (own) database config
const database = require("./database");

// session middleware
const session = require('express-session');
const MySQLStore = require('express-mysql-session')(session);

const sessionStore = new MySQLStore({}, database);
sessionStore.all(function(error, sessions) {
    console.log('all sessions:', sessions);
 });
// setting up session middleware
app.use(session({
    secret: 'asdasdcads',
    createDatabaseTable: true,
    store: sessionStore,
    resave: false,
    saveUninitialized: false,
    expiration: 600000,
    cookie: {
        sameSite: 'lax',
        domain: 'localhost'
    },
    secure: false
}));
</code>```

When I open the site in localhost:80 (docker container mapped 80:3000), the sessions get created with IDs and when saveUninitialized is set to true the sessions are even stored in my db. The last step, setting the cookie in the browser fails. Instead, if I refresh the site, a new session is created.
I guess the session middleware is not adding a Set-Cookie to the response but I really wonder why and how I can look into it more deeply. I asked chatGPT and added a bunch of stuff to the cookie and session config to make it work, like you can see, but no success. ChatGPT also recommended to set cors after session but later reverted that.

Body:
Setup
I run two docker containers locally. One express backend and one next.js frontend. My database is on a remote server.

Backend snippet:

const corsOptions = {
    origin: '*',
    credentials: true,
};
app.use(cors(corsOptions));

app.use(express.static("public"));

app.use(express.json()); // lets us interpret(parse) post requests and returns an Object
app.use(express.urlencoded({ extended: true }));

// import (own) database config
const database = require("./database");

// session middleware
const session = require('express-session');
const MySQLStore = require('express-mysql-session')(session);

const sessionStore = new MySQLStore({}, database);
sessionStore.all(function(error, sessions) {
    console.log('all sessions:', sessions);
 });
// setting up session middleware
app.use(session({
    secret: 'asdasdcads',
    createDatabaseTable: true,
    store: sessionStore,
    resave: false,
    saveUninitialized: false,
    expiration: 600000,
    cookie: {
        sameSite: 'lax',
        domain: 'localhost'
    },
    secure: false
}));

When I open the site in localhost:80 (docker container mapped 80:3000), the sessions get created with IDs and when saveUninitialized is set to true the sessions are even stored in my db. The last step, setting the cookie in the browser fails. Instead, if I refresh the site, a new session is created.
I guess the session middleware is not adding a Set-Cookie to the response but I really wonder why and how I can look into it more deeply. I asked chatGPT and added a bunch of stuff to the cookie and session config to make it work, like you can see, but no success. ChatGPT also recommended to set cors after session but later reverted that.


问:
spark datame column and row above 2gb
I'm using spark with delta lake (python) where I read a 10 gb json file.

This file contains 5 columns, but one of them is a struct column that contains more than 100 columns, including string, long, array and struct types.

As I am using delta lake, I would like to save this dataframe entirely in a bronze table of delta lake.

However, a buffer error occurs, it cannot be above 2gb. I suppose that the column or row cannot be larger than 2gb. However, I suppose this is a spark limitation that was fixed in previous versions, but it still persists in version 3.2.1.

Does anyone have any idea how I can resolve this?

How can I store large files in delta lake bronze tables without performing datafrane transformations to store in delta lake bronze tables?

Thank you very much

Carlos

Title: spark datame column and row above 2gb


问:
Change Number Format in .NET-6 Core MVC
I want to show the phone number in custom format.

change this 1234567891 to 123-456-7891

I change the Date Format it works but the number format doesn't work form me.

```<code>    public DateTime dateOfBirth { get; set; }

    public string contactNumber { get; set; }
</code>```
@employee.contactNumber.ToString("###-###-####")     // This is not work
@employee.dateOfBirth.ToString("MMMM dd yyyy")

Title: Change Number Format in .NET-6 Core MVC

Body:
I want to show the phone number in custom format.

change this 1234567891 to 123-456-7891

I change the Date Format it works but the number format doesn't work form me.

    public DateTime dateOfBirth { get; set; }

    public string contactNumber { get; set; }

@employee.contactNumber.ToString("###-###-####")     // This is not work
@employee.dateOfBirth.ToString("MMMM dd yyyy")


问:
Why does nuxt3 getCookie() give different results based on where the route is called from?
I have a simple route in server/api/verify.js

import jsonwebtoken from 'jsonwebtoken'

export default defineEventHandler(async (event) => {
  let error = null
  const token = getCookie(event, 'jwt')

  if (token) {
    await jsonwebtoken.verify(token, 'someSecret', (err) => {
      if (err) { error = err.message }
    })
  } else {
    return { error: 'no token' }
  }

  return error ? { error } : { ok: true }
})
```
<p>and if I test the route in the browser, it gives the expected results,<br />
but when I try to use it in a component or in a middleware function with:</p>
<pre class="lang-js prettyprint-override"><code>const { data } = await useFetch('/api/verify')
</code>```

then it always results in no token error. The token is undefined.   What am I missing?

Body:
I have a simple route in server/api/verify.js

import jsonwebtoken from 'jsonwebtoken'

export default defineEventHandler(async (event) => {
  let error = null
  const token = getCookie(event, 'jwt')

  if (token) {
    await jsonwebtoken.verify(token, 'someSecret', (err) => {
      if (err) { error = err.message }
    })
  } else {
    return { error: 'no token' }
  }

  return error ? { error } : { ok: true }
})

and if I test the route in the browser, it gives the expected results,

but when I try to use it in a component or in a middleware function with:

const { data } = await useFetch('/api/verify')

then it always results in no token error. The token is undefined.   What am I missing?


问:
Unable to write to JSON file from Qt
I have a program where I store some attributes in a class and then I create objects for that. Then I store those objects in a vector. I can sort and manipulate it. Now when I try to write out that data to a .JSON file, it does not do that.

My Code -

```<code>#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonValue>

vector<FlightData>FlightList;
vector<QJsonObject> JsonArray;

void MainWindow::WriteToJson()
{
    sort(FlightList.begin(), FlightList.end());

    vector<FlightData>::iterator itr;

    for (itr = FlightList.begin(); itr != FlightList.end(); itr++)
    {
        static int i = 0;
        QString Time = QString::fromStdString(FlightList[i].getTime());
        QString Latitude = QString::number(FlightList[i].getLatitude());
        QString Longitude = QString::number(FlightList[i].getLongitude());
        QString Course = QString::number(FlightList[i].getCourse());
        QString KTS = QString::number(FlightList[i].getKTS());
        QString MPH = QString::number(FlightList[i].getMPH());
        QString AltitudeFeet = QString::number(FlightList[i].getAltitudeFeet());
        QString ReportingFacility = QString::fromStdString(FlightList[i].getReportingFacility());
        i++;

        QJsonObject obj;

        obj.insert("Time", Time+",");
        obj.insert("Latitude", Latitude+",");
        obj.insert("Longitude", Longitude+",");
        obj.insert("Course", Course+",");
        obj.insert("KTS", KTS+",");
        obj.insert("MPH", MPH+",");
        obj.insert("AltitudeFeet", AltitudeFeet+",");
        obj.insert("ReportingFacility", ReportingFacility+",");

        JsonArray.push_back(obj);
    }
}
</code>```
```<code>void MainWindow::on_Write_JSON_clicked()
{
    WriteToJson();
    QFile JsonFile("FlightDatar.json");

    if(JsonArray.empty())
    {
        qDebug() << "Unable to write to JSON as JsonArray is empty";
    }

    if(!JsonArray.empty())
    {
        if(JsonFile.open(QIODevice::WriteOnly | QIODevice::Text))
        {
            QTextStream out(&JsonFile);

            for(auto itr = JsonArray.begin(); itr != JsonArray.end(); itr++)
            {
                out << QJsonDocument(*itr).toJson() << Qt::endl;
                qDebug() << *itr;
            }
            ui->statusbar->showMessage("Writing to JSON successful", 4000);

            JsonArray.clear();
            JsonFile.flush();
            JsonFile.close();
        }
    }
}
</code>```

The interesting part is- the values get printed on the console with the qDebug() but they are not getting written into Flight_Datar.json for some reason.
Kindly help me if you can.

Title: Unable to write to JSON file from Qt

Body:
I have a program where I store some attributes in a class and then I create objects for that. Then I store those objects in a vector. I can sort and manipulate it. Now when I try to write out that data to a .JSON file, it does not do that.

My Code -

#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonValue>

vector<FlightData>FlightList;
vector<QJsonObject> JsonArray;

void MainWindow::WriteToJson()
{
    sort(FlightList.begin(), FlightList.end());

    vector<FlightData>::iterator itr;

    for (itr = FlightList.begin(); itr != FlightList.end(); itr++)
    {
        static int i = 0;
        QString Time = QString::fromStdString(FlightList[i].getTime());
        QString Latitude = QString::number(FlightList[i].getLatitude());
        QString Longitude = QString::number(FlightList[i].getLongitude());
        QString Course = QString::number(FlightList[i].getCourse());
        QString KTS = QString::number(FlightList[i].getKTS());
        QString MPH = QString::number(FlightList[i].getMPH());
        QString AltitudeFeet = QString::number(FlightList[i].getAltitudeFeet());
        QString ReportingFacility = QString::fromStdString(FlightList[i].getReportingFacility());
        i++;

        QJsonObject obj;

        obj.insert("Time", Time+",");
        obj.insert("Latitude", Latitude+",");
        obj.insert("Longitude", Longitude+",");
        obj.insert("Course", Course+",");
        obj.insert("KTS", KTS+",");
        obj.insert("MPH", MPH+",");
        obj.insert("AltitudeFeet", AltitudeFeet+",");
        obj.insert("ReportingFacility", ReportingFacility+",");

        JsonArray.push_back(obj);
    }
}

void MainWindow::on_Write_JSON_clicked()
{
    WriteToJson();
    QFile JsonFile("FlightDatar.json");

    if(JsonArray.empty())
    {
        qDebug() << "Unable to write to JSON as JsonArray is empty";
    }

    if(!JsonArray.empty())
    {
        if(JsonFile.open(QIODevice::WriteOnly | QIODevice::Text))
        {
            QTextStream out(&JsonFile);

            for(auto itr = JsonArray.begin(); itr != JsonArray.end(); itr++)
            {
                out << QJsonDocument(*itr).toJson() << Qt::endl;
                qDebug() << *itr;
            }
            ui->statusbar->showMessage("Writing to JSON successful", 4000);

            JsonArray.clear();
            JsonFile.flush();
            JsonFile.close();
        }
    }
}

The interesting part is- the values get printed on the console with the qDebug() but they are not getting written into Flight_Datar.json for some reason.
Kindly help me if you can.


问:
Typing mongoose discriminators
I'm trying to make my TypeScript interfaces work with my discriminated mongoose models but I'm unable to get the base model type to understand what different discriminator tag it has. Is it even possible to have TS infer this or will I have to explicitly type this myself?</p>

Title: Typing mongoose discriminators


问:
For Binding Property in Xamarin Forms
enter image description here This is the data that is stored in listview
I am trying to show ChampName and ChampImage on the page
Therefore, I used Binding in this code but nothing show up...

Please help me Thank you.

```<code> public class UserChamp
    {

        [JsonProperty("championId")]
        public int champID { get; set; }
        [JsonProperty("championPoints")]
        public int points { get; set; }
        public string ChampName { get; set; }
        public string ChampImage { get; set; }

    }
</code>```
```<code>List<UserChamp> champList;

            for (int i = 0; i < userChamps.Length; i++)
            {
                if (userChamps[i].champID == Convert.ToInt32(championDTO.data.Aatrox.key))
                {
                    UserChamp user = new UserChamp {

                        ChampName = championDTO.data.Aatrox.name,
                        ChampImage = "http://ddragon.leagueoflegends.com/cdn/12.23.1/img/champion/Atrox.png"

                    };

                    champList.Add(user);
                }
                if (userChamps[i].champID == Convert.ToInt32(championDTO.data.Ahri.key))
                {
                    UserChamp user = new UserChamp
                    {

                        ChampName = championDTO.data.Ahri.name,
                        ChampImage = "http://ddragon.leagueoflegends.com/cdn/12.23.1/img/champion/Ahri.png"

                    };
                    champList.Add(user);
                } ....
 champLv.ItemsSource = champList;  // champLv is listview

</code>```

// this is xml for showing champion Image and Names.

```<code><?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="FinalProject.Champions">
    <ContentPage.Content>
        <StackLayout>
            <ListView x:Name="champLv">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Orientation="Horizontal">
                                <Image Source="{Binding ChampImage}" HeightRequest="100" WidthRequest="100" />
                                <Label Text="{Binding ChampName}" />
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>
</code>```
```<code> private async void Clicked(object sender, ItemTappedEventArgs e)
        {
            champ = new Champions();
            await Navigation.PushAsync(champ, true);

        }
</code>```

I expect to see champion Images and Names.
The listview is saved correctly.
The page I want to show up is champ page so I am using await Navigation.PushAsync(champ, true); in my mainpage so I can go over to it when I click summoner icon

Title: For Binding Property in Xamarin Forms

Body:
enter image description here This is the data that is stored in listview
I am trying to show ChampName and ChampImage on the page
Therefore, I used Binding in this code but nothing show up...

Please help me Thank you.

 public class UserChamp
    {

        [JsonProperty("championId")]
        public int champID { get; set; }
        [JsonProperty("championPoints")]
        public int points { get; set; }
        public string ChampName { get; set; }
        public string ChampImage { get; set; }

    }

List<UserChamp> champList;

            for (int i = 0; i < userChamps.Length; i++)
            {
                if (userChamps[i].champID == Convert.ToInt32(championDTO.data.Aatrox.key))
                {
                    UserChamp user = new UserChamp {

                        ChampName = championDTO.data.Aatrox.name,
                        ChampImage = "http://ddragon.leagueoflegends.com/cdn/12.23.1/img/champion/Atrox.png"

                    };

                    champList.Add(user);
                }
                if (userChamps[i].champID == Convert.ToInt32(championDTO.data.Ahri.key))
                {
                    UserChamp user = new UserChamp
                    {

                        ChampName = championDTO.data.Ahri.name,
                        ChampImage = "http://ddragon.leagueoflegends.com/cdn/12.23.1/img/champion/Ahri.png"

                    };
                    champList.Add(user);
                } ....
 champLv.ItemsSource = champList;  // champLv is listview

// this is xml for showing champion Image and Names.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="FinalProject.Champions">
    <ContentPage.Content>
        <StackLayout>
            <ListView x:Name="champLv">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Orientation="Horizontal">
                                <Image Source="{Binding ChampImage}" HeightRequest="100" WidthRequest="100" />

                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

 private async void Clicked(object sender, ItemTappedEventArgs e)
        {
            champ = new Champions();
            await Navigation.PushAsync(champ, true);

        }

I expect to see champion Images and Names.
The listview is saved correctly.
The page I want to show up is champ page so I am using await Navigation.PushAsync(champ, true); in my mainpage so I can go over to it when I click summoner icon


问:
ReportScheduleUnexpected Error when configuring superset alerts and reports
i'm trying to configure superset alerts and reporting (deployed on kubernetes) but i'm running into a bug when my alert tries to screenshot my chart. After configuring the alert, I get the following logs in my superset worker node:

```<code>superset Scheduling alert Test2 eta: 2022-12-10 00:40:00
│ superset [2022-12-10 00:40:00,367: INFO/ForkPoolWorker-31] Scheduling alert Test2 eta: 2022-12-10 00:40:00
│ superset Query for Test2 took 170.06 ms
│ superset [2022-12-10 00:40:00,751: INFO/ForkPoolWorker-31] Query for Test2 took 170.06 ms
│ superset Screenshotting chart at http://superset:8088/superset/slice/93/?standalone=true
│ superset [2022-12-10 00:40:00,764: INFO/ForkPoolWorker-31] Screenshotting chart at http://superset:8088/superset/slice/93/?standalone=true
│ superset Init selenium driver                                                                                │
│ superset [2022-12-10 00:40:00,767: INFO/ForkPoolWorker-31] Init selenium driver
superset Taking a PNG screenshot or url http://superset:8088/superset/slice/93/?standalone=true&standalone=3                                                                   │
│ superset [2022-12-10 00:40:11,678: INFO/ForkPoolWorker-31] Taking a PNG screenshot or url http://superset:8088/superset/slice/93/?standalone=true&standalone=3                                          │
│ superset (Background on this error at: http://sqlalche.me/e/13/2j85)
│ superset
│ superset During handling of the above exception, another exception occurred:
│ superset
│ superset Traceback (most recent call last):
│ superset  File "/app/superset/tasks/scheduler.py", line 71, in execute
│ superset   task_id, report_schedule_id, scheduled_dttm_,
│ superset  File "/app/superset/reports/commands/execute.py", line 584, in run
│ superset   raise ReportScheduleUnexpectedError(str(ex))
│ superset superset.reports.commands.exceptions.ReportScheduleUnexpectedError: (psycopg2.errors.IdleInTransactionSessionTimeout) terminating connection due to idle-in-transaction timeout
│ superset SSL connection has been closed unexpectedly
</code>```

I've enabled THUMBNAIL_SELENIUM_USER="admin" and verified that a superset user named admin has admin rights and verified that the slice it's trying to access does, in fact, exist. Has anyone else come across this bug before?

I've gotten the same configuration to work in my staging environment but not in production.

Body:
i'm trying to configure superset alerts and reporting (deployed on kubernetes) but i'm running into a bug when my alert tries to screenshot my chart. After configuring the alert, I get the following logs in my superset worker node:

superset Scheduling alert Test2 eta: 2022-12-10 00:40:00
│ superset [2022-12-10 00:40:00,367: INFO/ForkPoolWorker-31] Scheduling alert Test2 eta: 2022-12-10 00:40:00
│ superset Query for Test2 took 170.06 ms
│ superset [2022-12-10 00:40:00,751: INFO/ForkPoolWorker-31] Query for Test2 took 170.06 ms
│ superset Screenshotting chart at http://superset:8088/superset/slice/93/?standalone=true
│ superset [2022-12-10 00:40:00,764: INFO/ForkPoolWorker-31] Screenshotting chart at http://superset:8088/superset/slice/93/?standalone=true
│ superset Init selenium driver                                                                                │
│ superset [2022-12-10 00:40:00,767: INFO/ForkPoolWorker-31] Init selenium driver
superset Taking a PNG screenshot or url http://superset:8088/superset/slice/93/?standalone=true&standalone=3                                                                   │
│ superset [2022-12-10 00:40:11,678: INFO/ForkPoolWorker-31] Taking a PNG screenshot or url http://superset:8088/superset/slice/93/?standalone=true&standalone=3                                          │
│ superset (Background on this error at: http://sqlalche.me/e/13/2j85)
│ superset
│ superset During handling of the above exception, another exception occurred:
│ superset
│ superset Traceback (most recent call last):
│ superset  File "/app/superset/tasks/scheduler.py", line 71, in execute
│ superset   task_id, report_schedule_id, scheduled_dttm_,
│ superset  File "/app/superset/reports/commands/execute.py", line 584, in run
│ superset   raise ReportScheduleUnexpectedError(str(ex))
│ superset superset.reports.commands.exceptions.ReportScheduleUnexpectedError: (psycopg2.errors.IdleInTransactionSessionTimeout) terminating connection due to idle-in-transaction timeout
│ superset SSL connection has been closed unexpectedly

I've enabled THUMBNAIL_SELENIUM_USER="admin" and verified that a superset user named admin has admin rights and verified that the slice it's trying to access does, in fact, exist. Has anyone else come across this bug before?

I've gotten the same configuration to work in my staging environment but not in production.


问:
ISO Disc Image to MP4 Fails only when using Queue [handbrake]
I'm using the latest Handbrake portable version, I haven't changed any settings other than selecting 'Web Optimized'.

I have a folder full of .ISO files (home movies converted from vhs, unencrypted), when I select one file at a time I am able to convert them great. When I choose folder and add all to Queue, the first ISO file will convert, but each file after that will quickly fail.

Here is the log of the 2nd file (failed):

```<code>HandBrake 1.5.1 (2022011000)
OS: Microsoft Windows NT 10.0.22000.0
CPU: 11th Gen Intel(R) Core(TM) i3- @ 3.00GHz
Ram: 7934 MB,
GPU Information:
  Intel(R) UHD Graphics - 30.0.100.9864
Screen: 1536x864
Temp Dir: C:\Users\x\AppData\Local\Temp\
Install Dir: C:\Users\x\Downloads\HandBrake-1.5.1-x86_64-Win_GUI\HandBrake\
Data Dir: C:\Users\x\AppData\Roaming\HandBrake

-------------------------------------------

 # Starting Encode ...

[13:35:33] base preset: Fast 1080p30
[13:35:33] Remote Process started with Process ID: 12816 using port: 8037. Max Allowed Instances: 1
[13:35:41] Worker: Starting HandBrake Engine ...
[13:35:41] Worker: Starting Web Server on port 8037 ...
[13:35:42] Worker: Disconnected worker monitoring enabled!
[13:35:42] Compile-time hardening features are enabled
Cannot load nvEncodeAPI64.dll
Cannot load nvEncodeAPI64.dll
Cannot load nvEncodeAPI64.dll
Cannot load nvEncodeAPI64.dll
[13:35:42] hb_init: starting libhb thread
[13:35:42] Starting work at: Wed Dec 07 13:35:42 2022
[13:35:42] 1 job(s) to process
[13:35:42] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 160,
        "DRC": 0,
        "Encoder": "av_aac",
        "Gain": 0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:ac3",
      "copy:dtshd",
      "copy:dts",
      "copy:eac3",
      "copy:flac",
      "copy:mp3",
      "copy:truehd",
      "copy:mp2"
    ],
    "FallbackEncoder": "ac3"
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": true,
    "File": "C:\\Users\\x\\Videos\\xyz.m4v",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "av_mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 4,
        "Settings": {
          "mode": "7"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 13,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "12",
          "crop-right": "0",
          "crop-top": "0",
          "height": "480",
          "width": "708"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "2",
          "rate": "27000000/900000"
        }
      }
    ]
  },
  "PAR": {
    "Num": 8,
    "Den": 9
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 2,
    "Path": "D:\\xyz.ISO"
  },
  "Subtitle": {
    "Search": {
      "Burn": true,
      "Default": false,
      "Enable": true,
      "Forced": true
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "x264",
    "Level": "4.0",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "fast",
    "Profile": "main",
    "Quality": 22,
    "QSV": {
      "Decode": false
    }
  }
}
[13:35:42] CPU: 11th Gen Intel(R) Core(TM) i3- @ 3.00GHz
[13:35:42]  - Intel microarchitecture Tiger Lake
[13:35:42]  - logical processor count: 4
[13:35:42] Intel Quick Sync Video support: yes, gpu list: 0
[13:35:42] Intel Quick Sync Video integrated adapter with index 0
[13:35:42]  - Intel Media SDK hardware: API 1.35 (minimum: 1.3)
[13:35:42]  - Decode support:  h264 hevc (8bit: yes, 10bit: yes) av1 (8bit: yes, 10bit: yes)
[13:35:42]  - H.264 encoder: yes
[13:35:42]     - preferred implementation: hardware (1) via D3D11
[13:35:42]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[13:35:42]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[13:35:42]     - preferred implementation: hardware (1) via D3D11
[13:35:42]     - capabilities (hardware):  lowpower bpyramid icq vsinfo opt1
[13:35:42] hb_scan: path=D:\xyz.ISO, title_index=2
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
src/libbluray/bluray.c:2646: nav_get_title_list((null)) failed
[13:35:42] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvdnav: DVD Title: XYZ
libdvdnav: DVD Serial Number: 1468DC55DVDSHR_XYZ
libdvdnav: DVD Title (Alternative):
libdvdnav: DVD disk reports itself with Region mask 0x00c00000. Regions: 01 02 03 04 05 06
libdvdread: Encrypted DVD support unavailable.
[13:35:42] scan: DVD has 1 title(s)
[13:35:42] scan: scanning title 2
[13:35:42] Invalid VTS (title set) number: 0
[13:35:42] libhb: scan thread found 0 valid title(s)
hb_dict_to_job: Title 2 doesn't exist
[13:35:42] Finished work at: Wed Dec 07 13:35:42 2022
[13:35:42] libhb: work result = 3

 # Job Failed to Initialise. Check log and input settings (3)
</code>```

Body:
I'm using the latest Handbrake portable version, I haven't changed any settings other than selecting 'Web Optimized'.

I have a folder full of .ISO files (home movies converted from vhs, unencrypted), when I select one file at a time I am able to convert them great. When I choose folder and add all to Queue, the first ISO file will convert, but each file after that will quickly fail.

Here is the log of the 2nd file (failed):

HandBrake 1.5.1 (2022011000)
OS: Microsoft Windows NT 10.0.22000.0
CPU: 11th Gen Intel(R) Core(TM) i3- @ 3.00GHz
Ram: 7934 MB,
GPU Information:
  Intel(R) UHD Graphics - 30.0.100.9864
Screen: 1536x864
Temp Dir: C:\Users\x\AppData\Local\Temp\
Install Dir: C:\Users\x\Downloads\HandBrake-1.5.1-x86_64-Win_GUI\HandBrake\
Data Dir: C:\Users\x\AppData\Roaming\HandBrake

-------------------------------------------

 # Starting Encode ...

[13:35:33] base preset: Fast 1080p30
[13:35:33] Remote Process started with Process ID: 12816 using port: 8037. Max Allowed Instances: 1
[13:35:41] Worker: Starting HandBrake Engine ...
[13:35:41] Worker: Starting Web Server on port 8037 ...
[13:35:42] Worker: Disconnected worker monitoring enabled!
[13:35:42] Compile-time hardening features are enabled
Cannot load nvEncodeAPI64.dll
Cannot load nvEncodeAPI64.dll
Cannot load nvEncodeAPI64.dll
Cannot load nvEncodeAPI64.dll
[13:35:42] hb_init: starting libhb thread
[13:35:42] Starting work at: Wed Dec 07 13:35:42 2022
[13:35:42] 1 job(s) to process
[13:35:42] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 160,
        "DRC": 0,
        "Encoder": "av_aac",
        "Gain": 0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:ac3",
      "copy:dtshd",
      "copy:dts",
      "copy:eac3",
      "copy:flac",
      "copy:mp3",
      "copy:truehd",
      "copy:mp2"
    ],
    "FallbackEncoder": "ac3"
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": true,
    "File": "C:\\Users\\x\\Videos\\xyz.m4v",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "av_mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 4,
        "Settings": {
          "mode": "7"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 13,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "12",
          "crop-right": "0",
          "crop-top": "0",
          "height": "480",
          "width": "708"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "2",
          "rate": "27000000/900000"
        }
      }
    ]
  },
  "PAR": {
    "Num": 8,
    "Den": 9
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 2,
    "Path": "D:\\xyz.ISO"
  },
  "Subtitle": {
    "Search": {
      "Burn": true,
      "Default": false,
      "Enable": true,
      "Forced": true
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "x264",
    "Level": "4.0",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "fast",
    "Profile": "main",
    "Quality": 22,
    "QSV": {
      "Decode": false
    }
  }
}
[13:35:42] CPU: 11th Gen Intel(R) Core(TM) i3- @ 3.00GHz
[13:35:42]  - Intel microarchitecture Tiger Lake
[13:35:42]  - logical processor count: 4
[13:35:42] Intel Quick Sync Video support: yes, gpu list: 0
[13:35:42] Intel Quick Sync Video integrated adapter with index 0
[13:35:42]  - Intel Media SDK hardware: API 1.35 (minimum: 1.3)
[13:35:42]  - Decode support:  h264 hevc (8bit: yes, 10bit: yes) av1 (8bit: yes, 10bit: yes)
[13:35:42]  - H.264 encoder: yes
[13:35:42]     - preferred implementation: hardware (1) via D3D11
[13:35:42]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[13:35:42]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[13:35:42]     - preferred implementation: hardware (1) via D3D11
[13:35:42]     - capabilities (hardware):  lowpower bpyramid icq vsinfo opt1
[13:35:42] hb_scan: path=D:\xyz.ISO, title_index=2
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
src/libbluray/bluray.c:2646: nav_get_title_list((null)) failed
[13:35:42] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvdnav: DVD Title: XYZ
libdvdnav: DVD Serial Number: 1468DC55DVDSHR_XYZ
libdvdnav: DVD Title (Alternative):
libdvdnav: DVD disk reports itself with Region mask 0x00c00000. Regions: 01 02 03 04 05 06
libdvdread: Encrypted DVD support unavailable.
[13:35:42] scan: DVD has 1 title(s)
[13:35:42] scan: scanning title 2
[13:35:42] Invalid VTS (title set) number: 0
[13:35:42] libhb: scan thread found 0 valid title(s)
hb_dict_to_job: Title 2 doesn't exist
[13:35:42] Finished work at: Wed Dec 07 13:35:42 2022
[13:35:42] libhb: work result = 3

 # Job Failed to Initialise. Check log and input settings (3)


问:
Column name issue from csv to MySQL
I have an issue with column names when I transfer csv file into MySQL workbench. Column name on csv file is like "Type of flight" and MySQL gives an error when I SELECT that particular column.
What can I do?

I tried to put underscore _ between words on the column name but it did not work.

Title: Column name issue from csv to MySQL


问:
get_values from Google Sheets using gspread python gives 500 Internal Error
I am using service account credentials and gspread to read from a Google Sheets worksheet.

```<code>from oauth2client.service_account import ServiceAccountCredentials
import gspread
</code>```

gspread version: 5.6.2
oauth2client version: 4.1.3
python version: 3.8.2

This is the code I am using to read the data

```<code>def __init__(self):
    SCOPES = ['https://www.googleapis.com/auth/spreadsheets',
            'https://www.googleapis.com/auth/drive']

    creds = ServiceAccountCredentials.from_json_keyfile_name('credentials.json', SCOPES)

    self.file = gspread.authorize(creds)
    self.workbook = self.file.open("Example Data")
    print(self.workbook)
    self.populateAllData()

def populateAllData(self):
    self.worksheet = self.workbook.get_worksheet_by_id(0)
    self.config_worksheet = self.workbook.get_worksheet_by_id(xxxxx)
    self.config_worksheet_local = self.config_worksheet.get_values()
    self.worksheet_local = self.worksheet.get_values()

</code>```

At the first call of get_values, I get the following error.

```<code>File "main.py", line 31, in populateAllData
    self.config_worksheet_local = self.config_worksheet.get_values()
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/utils.py", line 674, in wrapper
    return f(*args, **kwargs)
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/worksheet.py", line 403, in get_values
    return fill_gaps(self.get(range_name, **kwargs))
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/utils.py", line 674, in wrapper
    return f(*args, **kwargs)
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/worksheet.py", line 713, in get
    response = self.spreadsheet.values_get(range_name, params=params)
  File "/Users/xxxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/spreadsheet.py", line 182, in values_get
    r = self.client.request("get", url, params=params)
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/client.py", line 92, in request
    raise APIError(response)
gspread.exceptions.APIError: {'code': 500, 'message': 'Internal error encountered.', 'status': 'INTERNAL'}
</code>```

This piece of code with the credentials provided was working properly till a few days back, but now it consistently fails with this error. I saw people facing the same issue in the past because of making too many requests or reading from a sheet with large amount of data. But that is not the problem in my case.

Has anyone faced the same problem? Or can guide me to where I can read more logs or get more details about the error, and a possible path to debug this?

Body:
I am using service account credentials and gspread to read from a Google Sheets worksheet.

from oauth2client.service_account import ServiceAccountCredentials
import gspread

gspread version: 5.6.2
oauth2client version: 4.1.3
python version: 3.8.2

This is the code I am using to read the data

def __init__(self):
    SCOPES = ['https://www.googleapis.com/auth/spreadsheets',
            'https://www.googleapis.com/auth/drive']

    creds = ServiceAccountCredentials.from_json_keyfile_name('credentials.json', SCOPES)

    self.file = gspread.authorize(creds)
    self.workbook = self.file.open("Example Data")
    print(self.workbook)
    self.populateAllData()

def populateAllData(self):
    self.worksheet = self.workbook.get_worksheet_by_id(0)
    self.config_worksheet = self.workbook.get_worksheet_by_id(xxxxx)
    self.config_worksheet_local = self.config_worksheet.get_values()
    self.worksheet_local = self.worksheet.get_values()

At the first call of get_values, I get the following error.

File "main.py", line 31, in populateAllData
    self.config_worksheet_local = self.config_worksheet.get_values()
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/utils.py", line 674, in wrapper
    return f(*args, **kwargs)
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/worksheet.py", line 403, in get_values
    return fill_gaps(self.get(range_name, **kwargs))
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/utils.py", line 674, in wrapper
    return f(*args, **kwargs)
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/worksheet.py", line 713, in get
    response = self.spreadsheet.values_get(range_name, params=params)
  File "/Users/xxxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/spreadsheet.py", line 182, in values_get
    r = self.client.request("get", url, params=params)
  File "/Users/xxxxxx/Library/Python/3.8/lib/python/site-packages/gspread/client.py", line 92, in request
    raise APIError(response)
gspread.exceptions.APIError: {'code': 500, 'message': 'Internal error encountered.', 'status': 'INTERNAL'}

This piece of code with the credentials provided was working properly till a few days back, but now it consistently fails with this error. I saw people facing the same issue in the past because of making too many requests or reading from a sheet with large amount of data. But that is not the problem in my case.

Has anyone faced the same problem? Or can guide me to where I can read more logs or get more details about the error, and a possible path to debug this?


问:
Issues with setting up redis cluster via docker
I am trying to configure the Redis cluster using the docker image bitnami/redis-cluster.

Following is the docker-compose.yml:

```<code>version: '3.8'

services:
  redis-node-0:
    image: bitnami/redis-cluster:6.2.7
    volumes:
      - redis-node-data-0:/bitnami/redis/data
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_NODES=redis-node-0 redis-node-1 redis-node-2

  redis-node-1:
    image: bitnami/redis-cluster:6.2.7
    volumes:
      - redis-node-data-1:/bitnami/redis/data
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_NODES=redis-node-0 redis-node-1 redis-node-2

  redis-node-2:
    image: bitnami/redis-cluster:6.2.7
    volumes:
      - redis-node-data-2:/bitnami/redis/data
    ports:
      - 6379:6379
    depends_on:
      - redis-node-0
      - redis-node-1
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_NODES=redis-node-0 redis-node-1 redis-node-2
      - REDIS_CLUSTER_REPLICAS=1
      - REDIS_CLUSTER_CREATOR=yes

volumes:
  redis-node-data-0:
    driver: local
  redis-node-data-1:
    driver: local
  redis-node-data-2:
    driver: local
networks:
  default:
    name: local_network

</code>```

Docker container's are perfectly running:
Output of docker ps:

CONTAINER ID
IMAGE
COMMAND
CREATED
STATUS
PORTS
NAMES

bea9a7c52eba
bitnami/redis-cluster:6.2.7
"/opt/bitnami/script…"
12 minutes ago
12 minutes ago
0.0.0.0:6379->6379/tcp
local-redis-node-2-1

63c08f1330e0
bitnami/redis-cluster:6.2.7
"/opt/bitnami/script…"
12 minutes ago
12 minutes ago
6379/tcp
local-redis-node-1-1

e1b163d75254
bitnami/redis-cluster:6.2.7
"/opt/bitnami/script…"
12 minutes ago
12 minutes ago
6379/tcp
local-redis-node-0-1

As I have set local-redis-node-2-1 as REDIS_CLUSTER_CREATOR, now it is the incharge of initializing the cluster. Therefore, I am executing all below commands with this node.

Going inside container: docker exec -it local-redis-node-2-1 redis-cli

Then, trying to save data in redis set a 1, I am getting error: (error) CLUSTERDOWN Hash slot not serve

Output of cluster slots: (empty array)

I tried docker exec -it local-redis-node-2-1 redis-cli --cluster fix localhost:6379. But it is assigning 6379 slots out of 16383 to local-redis-node-2-1 only, remaining slots are not getting assigned to other nodes. Below is the output of cluster slots after fixing via above command:

```<code>127.0.0.1:6379> cluster slots
1) 1) (integer) 0
   2) (integer) 16383
   3) 1) "172.18.0.9"
      2) (integer) 6379
      3) "819770cf8b39793517efa10b9751083c854e15d7"
</code>```

I am doing something wrong. I would love to know the manual solution as well but more interested in knowing the solution to set cluster slots via docker-compose.

Can someone help me in setting the cluster slots automatically via docker-compose.yml?

The read replicas will work or not with this docker-compose.yml or have I missed something?

Also, can someone confirm whether the cluster will work fine after resolving the cluster slots or not?

Logs of local-redis-node-2-1 below:

```<code>redis-cluster 00:47:45.70
redis-cluster 00:47:45.73 Welcome to the Bitnami redis-cluster container
redis-cluster 00:47:45.76 Subscribe to project updates by watching https://github.com/bitnami/containers
redis-cluster 00:47:45.78 Submit issues and feature requests at https://github.com/bitnami/containers/issues
redis-cluster 00:47:45.80
redis-cluster 00:47:45.83 INFO  ==> ** Starting Redis setup **
redis-cluster 00:47:46.00 WARN  ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment.
redis-cluster 00:47:46.05 INFO  ==> Initializing Redis
redis-cluster 00:47:46.29 INFO  ==> Setting Redis config file
Changing old IP 172.18.0.8 by the new one 172.18.0.8
Changing old IP 172.18.0.6 by the new one 172.18.0.6
Changing old IP 172.18.0.9 by the new one 172.18.0.9
redis-cluster 00:47:47.30 INFO  ==> ** Redis setup finished! **

1:C 10 Dec 2022 00:47:47.579 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 10 Dec 2022 00:47:47.580 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 10 Dec 2022 00:47:47.580 # Configuration loaded
1:M 10 Dec 2022 00:47:47.584 * monotonic clock: POSIX clock_gettime
1:M 10 Dec 2022 00:47:47.588 * Node configuration loaded, I'm 819770cf8b39793517efa10b9751083c854e15d7
1:M 10 Dec 2022 00:47:47.595 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
1:M 10 Dec 2022 00:47:47.598 * Running mode=cluster, port=6379.
1:M 10 Dec 2022 00:47:47.599 # Server initialized
1:M 10 Dec 2022 00:47:47.612 * Ready to accept connections
1:M 10 Dec 2022 00:47:49.673 # Cluster state changed: ok
</code>```

Logs of local-redis-node-1-1 below:

```<code>redis-cluster 00:47:45.43
redis-cluster 00:47:45.46 Welcome to the Bitnami redis-cluster container
redis-cluster 00:47:45.48 Subscribe to project updates by watching https://github.com/bitnami/containers
redis-cluster 00:47:45.51 Submit issues and feature requests at https://github.com/bitnami/containers/issues
redis-cluster 00:47:45.54
redis-cluster 00:47:45.56 INFO  ==> ** Starting Redis setup **
redis-cluster 00:47:45.73 WARN  ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment.
redis-cluster 00:47:45.79 INFO  ==> Initializing Redis
redis-cluster 00:47:46.00 INFO  ==> Setting Redis config file
Changing old IP 172.18.0.8 by the new one 172.18.0.8
Changing old IP 172.18.0.6 by the new one 172.18.0.6
Changing old IP 172.18.0.9 by the new one 172.18.0.9
redis-cluster 00:47:47.10 INFO  ==> ** Redis setup finished! **

1:C 10 Dec 2022 00:47:47.387 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 10 Dec 2022 00:47:47.388 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 10 Dec 2022 00:47:47.388 # Configuration loaded
1:M 10 Dec 2022 00:47:47.392 * monotonic clock: POSIX clock_gettime
1:M 10 Dec 2022 00:47:47.395 * Node configuration loaded, I'm 2ab0b8db952cc101f7873cdcf8cf691f8f6bae7b
1:M 10 Dec 2022 00:47:47.403 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
1:M 10 Dec 2022 00:47:47.406 * Running mode=cluster, port=6379.
1:M 10 Dec 2022 00:47:47.407 # Server initialized
1:M 10 Dec 2022 00:47:47.418 * Ready to accept connections
1:M 10 Dec 2022 00:56:02.716 # New configEpoch set to 1
1:M 10 Dec 2022 00:56:41.943 # Cluster state changed: ok
</code>```

Logs of local-redis-node-0-1 below:

```<code>redis-cluster 00:47:45.43
redis-cluster 00:47:45.46 Welcome to the Bitnami redis-cluster container
redis-cluster 00:47:45.49 Subscribe to project updates by watching https://github.com/bitnami/containers
redis-cluster 00:47:45.51 Submit issues and feature requests at https://github.com/bitnami/containers/issues
redis-cluster 00:47:45.54
redis-cluster 00:47:45.56 INFO  ==> ** Starting Redis setup **
redis-cluster 00:47:45.73 WARN  ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment.
redis-cluster 00:47:45.79 INFO  ==> Initializing Redis
redis-cluster 00:47:46.00 INFO  ==> Setting Redis config file
Changing old IP 172.18.0.8 by the new one 172.18.0.8
Changing old IP 172.18.0.6 by the new one 172.18.0.6
Changing old IP 172.18.0.9 by the new one 172.18.0.9
redis-cluster 00:47:47.11 INFO  ==> ** Redis setup finished! **

1:C 10 Dec 2022 00:47:47.387 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 10 Dec 2022 00:47:47.388 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 10 Dec 2022 00:47:47.388 # Configuration loaded
1:M 10 Dec 2022 00:47:47.391 * monotonic clock: POSIX clock_gettime
1:M 10 Dec 2022 00:47:47.395 * Node configuration loaded, I'm 5ffeca48faa750a5f47c76639598fdb9b7b8b720
1:M 10 Dec 2022 00:47:47.402 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
1:M 10 Dec 2022 00:47:47.405 * Running mode=cluster, port=6379.
1:M 10 Dec 2022 00:47:47.405 # Server initialized
1:M 10 Dec 2022 00:47:47.415 * Ready to accept connections
</code>```

Body:
I am trying to configure the Redis cluster using the docker image bitnami/redis-cluster.

Following is the docker-compose.yml:

version: '3.8'

services:
  redis-node-0:
    image: bitnami/redis-cluster:6.2.7
    volumes:
      - redis-node-data-0:/bitnami/redis/data
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_NODES=redis-node-0 redis-node-1 redis-node-2

  redis-node-1:
    image: bitnami/redis-cluster:6.2.7
    volumes:
      - redis-node-data-1:/bitnami/redis/data
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_NODES=redis-node-0 redis-node-1 redis-node-2

  redis-node-2:
    image: bitnami/redis-cluster:6.2.7
    volumes:
      - redis-node-data-2:/bitnami/redis/data
    ports:
      - 6379:6379
    depends_on:
      - redis-node-0
      - redis-node-1
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_NODES=redis-node-0 redis-node-1 redis-node-2
      - REDIS_CLUSTER_REPLICAS=1
      - REDIS_CLUSTER_CREATOR=yes

volumes:
  redis-node-data-0:
    driver: local
  redis-node-data-1:
    driver: local
  redis-node-data-2:
    driver: local
networks:
  default:
    name: local_network

Docker container's are perfectly running:
Output of docker ps:

CONTAINER ID
IMAGE
COMMAND
CREATED
STATUS
PORTS
NAMES

bea9a7c52eba
bitnami/redis-cluster:6.2.7
"/opt/bitnami/script…"
12 minutes ago
12 minutes ago
0.0.0.0:6379->6379/tcp
local-redis-node-2-1

63c08f1330e0
bitnami/redis-cluster:6.2.7
"/opt/bitnami/script…"
12 minutes ago
12 minutes ago
6379/tcp
local-redis-node-1-1

e1b163d75254
bitnami/redis-cluster:6.2.7
"/opt/bitnami/script…"
12 minutes ago
12 minutes ago
6379/tcp
local-redis-node-0-1

As I have set local-redis-node-2-1 as REDIS_CLUSTER_CREATOR, now it is the incharge of initializing the cluster. Therefore, I am executing all below commands with this node.

Going inside container: docker exec -it local-redis-node-2-1 redis-cli

Then, trying to save data in redis set a 1, I am getting error: (error) CLUSTERDOWN Hash slot not serve

Output of cluster slots: (empty array)

I tried docker exec -it local-redis-node-2-1 redis-cli --cluster fix localhost:6379. But it is assigning 6379 slots out of 16383 to local-redis-node-2-1 only, remaining slots are not getting assigned to other nodes. Below is the output of cluster slots after fixing via above command:

127.0.0.1:6379> cluster slots
1) 1) (integer) 0
   2) (integer) 16383
   3) 1) "172.18.0.9"
      2) (integer) 6379
      3) "819770cf8b39793517efa10b9751083c854e15d7"

I am doing something wrong. I would love to know the manual solution as well but more interested in knowing the solution to set cluster slots via docker-compose.

Can someone help me in setting the cluster slots automatically via docker-compose.yml?

The read replicas will work or not with this docker-compose.yml or have I missed something?

Also, can someone confirm whether the cluster will work fine after resolving the cluster slots or not?

Logs of local-redis-node-2-1 below:

redis-cluster 00:47:45.70
redis-cluster 00:47:45.73 Welcome to the Bitnami redis-cluster container
redis-cluster 00:47:45.76 Subscribe to project updates by watching https://github.com/bitnami/containers
redis-cluster 00:47:45.78 Submit issues and feature requests at https://github.com/bitnami/containers/issues
redis-cluster 00:47:45.80
redis-cluster 00:47:45.83 INFO  ==> ** Starting Redis setup **
redis-cluster 00:47:46.00 WARN  ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment.
redis-cluster 00:47:46.05 INFO  ==> Initializing Redis
redis-cluster 00:47:46.29 INFO  ==> Setting Redis config file
Changing old IP 172.18.0.8 by the new one 172.18.0.8
Changing old IP 172.18.0.6 by the new one 172.18.0.6
Changing old IP 172.18.0.9 by the new one 172.18.0.9
redis-cluster 00:47:47.30 INFO  ==> ** Redis setup finished! **

1:C 10 Dec 2022 00:47:47.579 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 10 Dec 2022 00:47:47.580 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 10 Dec 2022 00:47:47.580 # Configuration loaded
1:M 10 Dec 2022 00:47:47.584 * monotonic clock: POSIX clock_gettime
1:M 10 Dec 2022 00:47:47.588 * Node configuration loaded, I'm 819770cf8b39793517efa10b9751083c854e15d7
1:M 10 Dec 2022 00:47:47.595 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
1:M 10 Dec 2022 00:47:47.598 * Running mode=cluster, port=6379.
1:M 10 Dec 2022 00:47:47.599 # Server initialized
1:M 10 Dec 2022 00:47:47.612 * Ready to accept connections
1:M 10 Dec 2022 00:47:49.673 # Cluster state changed: ok

Logs of local-redis-node-1-1 below:

redis-cluster 00:47:45.43
redis-cluster 00:47:45.46 Welcome to the Bitnami redis-cluster container
redis-cluster 00:47:45.48 Subscribe to project updates by watching https://github.com/bitnami/containers
redis-cluster 00:47:45.51 Submit issues and feature requests at https://github.com/bitnami/containers/issues
redis-cluster 00:47:45.54
redis-cluster 00:47:45.56 INFO  ==> ** Starting Redis setup **
redis-cluster 00:47:45.73 WARN  ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment.
redis-cluster 00:47:45.79 INFO  ==> Initializing Redis
redis-cluster 00:47:46.00 INFO  ==> Setting Redis config file
Changing old IP 172.18.0.8 by the new one 172.18.0.8
Changing old IP 172.18.0.6 by the new one 172.18.0.6
Changing old IP 172.18.0.9 by the new one 172.18.0.9
redis-cluster 00:47:47.10 INFO  ==> ** Redis setup finished! **

1:C 10 Dec 2022 00:47:47.387 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 10 Dec 2022 00:47:47.388 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 10 Dec 2022 00:47:47.388 # Configuration loaded
1:M 10 Dec 2022 00:47:47.392 * monotonic clock: POSIX clock_gettime
1:M 10 Dec 2022 00:47:47.395 * Node configuration loaded, I'm 2ab0b8db952cc101f7873cdcf8cf691f8f6bae7b
1:M 10 Dec 2022 00:47:47.403 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
1:M 10 Dec 2022 00:47:47.406 * Running mode=cluster, port=6379.
1:M 10 Dec 2022 00:47:47.407 # Server initialized
1:M 10 Dec 2022 00:47:47.418 * Ready to accept connections
1:M 10 Dec 2022 00:56:02.716 # New configEpoch set to 1
1:M 10 Dec 2022 00:56:41.943 # Cluster state changed: ok

Logs of local-redis-node-0-1 below:

redis-cluster 00:47:45.43
redis-cluster 00:47:45.46 Welcome to the Bitnami redis-cluster container
redis-cluster 00:47:45.49 Subscribe to project updates by watching https://github.com/bitnami/containers
redis-cluster 00:47:45.51 Submit issues and feature requests at https://github.com/bitnami/containers/issues
redis-cluster 00:47:45.54
redis-cluster 00:47:45.56 INFO  ==> ** Starting Redis setup **
redis-cluster 00:47:45.73 WARN  ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment.
redis-cluster 00:47:45.79 INFO  ==> Initializing Redis
redis-cluster 00:47:46.00 INFO  ==> Setting Redis config file
Changing old IP 172.18.0.8 by the new one 172.18.0.8
Changing old IP 172.18.0.6 by the new one 172.18.0.6
Changing old IP 172.18.0.9 by the new one 172.18.0.9
redis-cluster 00:47:47.11 INFO  ==> ** Redis setup finished! **

1:C 10 Dec 2022 00:47:47.387 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 10 Dec 2022 00:47:47.388 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 10 Dec 2022 00:47:47.388 # Configuration loaded
1:M 10 Dec 2022 00:47:47.391 * monotonic clock: POSIX clock_gettime
1:M 10 Dec 2022 00:47:47.395 * Node configuration loaded, I'm 5ffeca48faa750a5f47c76639598fdb9b7b8b720
1:M 10 Dec 2022 00:47:47.402 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
1:M 10 Dec 2022 00:47:47.405 * Running mode=cluster, port=6379.
1:M 10 Dec 2022 00:47:47.405 # Server initialized
1:M 10 Dec 2022 00:47:47.415 * Ready to accept connections


问:
Copy client files when publishing
On a Net Core 7 web application I need to build a few client scripts (JS and LESS).

The scripts are in "./approot" and when I run the command npm run build this is done:

Build the files in "./approot" and save the output to "./approot/dist"

Delete the folder "./webroot" with all its contents.

Create a new "./webroot" and copy all files from "./approot/dist" to "./webroot"

So I have the following on project's .csproj file:

```<code><Target Name="Build Client" AfterTargets="Build">
  <Exec Command="npm install" />
  <Exec Command="npm run build" />
  <ItemGroup>
    <Content Include="webroot\**">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
</Target>
</code>```

When I publish the application steps (1) and (2) are done.

However the "./webroot" folder is not copied to publish folder.

So when I upload the web application to the server the client files are not found.

What am I doing wrong?

UPDATE The only way I am able to make this work is using:

```<code>  <Target Name="Copy Webroot" BeforeTargets="AssignTargetPaths" DependsOnTargets="PrepareForPublish">
    <Exec Command="npm install" />
    <Exec Command="npm run build" />
    <ItemGroup>
      <Content Include="webroot/**" CopyToPublishDirectory="Always" />
    </ItemGroup>
  </Target>
</code>```

I also kept the following so that Client is build when debugging:

```<code><Target Name="Build Client" AfterTargets="Build">
  <Exec Command="npm install" />
  <Exec Command="npm run build" />
  <ItemGroup>
    <Content Include="webroot\**">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
</Target>
</code>```

The problem is when I publish the application I see the client being build twice.

How to solve this?

Title: Copy client files when publishing

Body:
On a Net Core 7 web application I need to build a few client scripts (JS and LESS).

The scripts are in "./approot" and when I run the command npm run build this is done:

Build the files in "./approot" and save the output to "./approot/dist"

Delete the folder "./webroot" with all its contents.

Create a new "./webroot" and copy all files from "./approot/dist" to "./webroot"

So I have the following on project's .csproj file:

<Target Name="Build Client" AfterTargets="Build">
  <Exec Command="npm install" />
  <Exec Command="npm run build" />
  <ItemGroup>
    <Content Include="webroot\**">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
</Target>

When I publish the application steps (1) and (2) are done.

However the "./webroot" folder is not copied to publish folder.

So when I upload the web application to the server the client files are not found.

What am I doing wrong?

UPDATE The only way I am able to make this work is using:

  <Target Name="Copy Webroot" BeforeTargets="AssignTargetPaths" DependsOnTargets="PrepareForPublish">
    <Exec Command="npm install" />
    <Exec Command="npm run build" />
    <ItemGroup>
      <Content Include="webroot/**" CopyToPublishDirectory="Always" />
    </ItemGroup>
  </Target>

I also kept the following so that Client is build when debugging:

<Target Name="Build Client" AfterTargets="Build">
  <Exec Command="npm install" />
  <Exec Command="npm run build" />
  <ItemGroup>
    <Content Include="webroot\**">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
</Target>

The problem is when I publish the application I see the client being build twice.

How to solve this?


问:
How to fix No matching function Call to ... <unresolved overloaded function type>
I have cut out most of the unnecessary bits of code and abstracted it to get the gist of what I think is going wrong with my code. Hopefully it's not too vague.

I am trying to reverse engineer how some existing DeviceModels are implemented, called DeviceTypeA and DeviceTypeB. I am trying to create a new device model called DeviceTypeC. It registers a callback to an interfaceFacade to handle incoming messages for this particular device. When this class calls the function it hands the information about itself to the interface along with its callback function. From the interface Facade it passes it to a statusManager which is responsible for listening to incoming messages and routing them back to DeviceTypeA to be processed.

DeviceTypes A, B, and C are fairly unique, but interface with this status manager int the same manner. However, when I try to implement the same code logic for, "DeviceTypeC.registerForInterfaceMessages();"
I get the following errors:

```<code>Error: no matching function for call to 'MyInterface::InterfaceFacade::registerForStatus(int&, int&, void*, <unresolved overloaded function type>)'
        processMessageTypeA;

DeviceTypeC::DeviceTypeC.cpp note: candidates are:
In file included from DeviceTypeA.hpp
                from DeviceTypeC.cpp
InterfaceFacade.hpp note: MyInterface::InterfaceFacade::registerForStatus(int,int,void*,StatusManager::RouteC::MessageTypeACallback)
        void registerForStatus

InterfaceFacade.hpp note: no known conversion for argument 4 from '<unresolved overloaded function type>' to 'StatusManager::RouteC::MessageTypeACallback {aka void (*)(void*, const boost::shared_ptr<MessageAbstraction::MessageTypeA>&)}'
</code>```

I hope this abstraction isn't too confusing. It really doesn't make a lot of sense why the first two implementations would work (DeviceTypeA and DeviceTypeB), but mine wouldn't using the same code?

```<code>#include "DeviceTypeA.hpp"

namespace DeviceTypeA {

    DeviceTypeA::DeviceTypeA():m_interfacePtr(new MyInterface::InterfaceFacade(123,321))
    {
        registerForInterfaceMessages();
    };
    ~DeviceTypeA::DeviceTypeA(){};

    DeviceTypeA::registerForInterfaceMessages(){
        m_interfacePtr->registerForInterfaceMessages(123,321,static_cast<void*>(this),processMessageTypeA);
    }

    void DeviceTypeA::processMessageTypeA(void* thisptr, const boost::shared_ptr<MessageAbstraction::MessageTypeA>& msgPtr ){
        reinterpret_cast<DeviceTypeA*>(thisPtr)->processMessageTypeA_Impl(msgPtr);
    }

    void DeviceTypeA::processMessageTypeA_Impl(const boost::shared_ptr<MessageAbstraction::MessageTypeA>& msgPtr){
        //do stuff here
    }

}
</code>```

The interface Facade class passes this along to a status manager

```<code>    #include "InterfaceFacade.hpp"

    namespace MyInterface {

        InterfaceFacade::InterfaceFacade():m_statusMgrPtr(NULL)
        {
            m_statusMgrPtr = StatusManager::RouteC::instance();
        };
        ~InterfaceFacade::InterfaceFacade(){};

        void InterfaceFacade::registerForStatus(int id, int address, void* ptr, StatusManager::RouteC::MessageTypeACallback callback){
            if(NULL !=m_statusMgrPtr ){
                m_statusMgrPtr->registerForStatus(id,address,ptr,callback);
            }
        }

    }
</code>```

The status manager is then responsible for taking incoming messages and passing it back to the DeviceModelA class so that the method:

```<code> void DeviceTypeA::processMessageTypeA_Impl(const boost::shared_ptr<MessageAbstraction::MessageTypeA>& msgPtr)
</code>```

... can process what to do with the incoming message.

```<code>#include "StatusManager_RouteC.hpp"

namespace StautsManager {

    RouteC::RouteC(){};
    ~RouteC::RouteC(){};

    void RouteC::registerForStatus(int id, int address,void* ptr,MessageTypeACallback callback){
    //do stuff here
    }

    void RouteC::registerForStatus(int id, int address,void* ptr,MessageTypeBCallback callback){
    //do stuff here
    }

}

/*
RouteC.hpp
*/

namespace StatusManager {

class RouteC{
    public:
        RouteC::RouteC();
        ~RouteC::RouteC();

        typedef void (*MessageTypeACallback)(void*, const boost::shared_ptr<MessageAbstraction::MessageTypeA>& msg);
        typedef void (*MessageTypeBCallback)(void*, const boost::shared_ptr<MessageAbstraction::MessageTypeB>& msg);

        void RouteC::registerForStatus(int id, int address,void* ptr,MessageTypeACallback callback){
        //do stuff here
        }

        void RouteC::registerForStatus(int id, int address,void* ptr,MessageTypeBCallback callback){
        //do stuff here
        }
}

}
</code>```

Body:
I have cut out most of the unnecessary bits of code and abstracted it to get the gist of what I think is going wrong with my code. Hopefully it's not too vague.

I am trying to reverse engineer how some existing DeviceModels are implemented, called DeviceTypeA and DeviceTypeB. I am trying to create a new device model called DeviceTypeC. It registers a callback to an interfaceFacade to handle incoming messages for this particular device. When this class calls the function it hands the information about itself to the interface along with its callback function. From the interface Facade it passes it to a statusManager which is responsible for listening to incoming messages and routing them back to DeviceTypeA to be processed.

DeviceTypes A, B, and C are fairly unique, but interface with this status manager int the same manner. However, when I try to implement the same code logic for, "DeviceTypeC.registerForInterfaceMessages();"
I get the following errors:

Error: no matching function for call to 'MyInterface::InterfaceFacade::registerForStatus(int&, int&, void*, <unresolved overloaded function type>)'
        processMessageTypeA;

DeviceTypeC::DeviceTypeC.cpp note: candidates are:
In file included from DeviceTypeA.hpp
                from DeviceTypeC.cpp
InterfaceFacade.hpp note: MyInterface::InterfaceFacade::registerForStatus(int,int,void*,StatusManager::RouteC::MessageTypeACallback)
        void registerForStatus

InterfaceFacade.hpp note: no known conversion for argument 4 from '<unresolved overloaded function type>' to 'StatusManager::RouteC::MessageTypeACallback {aka void (*)(void*, const boost::shared_ptr<MessageAbstraction::MessageTypeA>&)}'

I hope this abstraction isn't too confusing. It really doesn't make a lot of sense why the first two implementations would work (DeviceTypeA and DeviceTypeB), but mine wouldn't using the same code?

#include "DeviceTypeA.hpp"

namespace DeviceTypeA {

    DeviceTypeA::DeviceTypeA():m_interfacePtr(new MyInterface::InterfaceFacade(123,321))
    {
        registerForInterfaceMessages();
    };
    ~DeviceTypeA::DeviceTypeA(){};

    DeviceTypeA::registerForInterfaceMessages(){
        m_interfacePtr->registerForInterfaceMessages(123,321,static_cast<void*>(this),processMessageTypeA);
    }

    void DeviceTypeA::processMessageTypeA(void* thisptr, const boost::shared_ptr<MessageAbstraction::MessageTypeA>& msgPtr ){
        reinterpret_cast<DeviceTypeA*>(thisPtr)->processMessageTypeA_Impl(msgPtr);
    }

    void DeviceTypeA::processMessageTypeA_Impl(const boost::shared_ptr<MessageAbstraction::MessageTypeA>& msgPtr){
        //do stuff here
    }

}

The interface Facade class passes this along to a status manager

    #include "InterfaceFacade.hpp"

    namespace MyInterface {

        InterfaceFacade::InterfaceFacade():m_statusMgrPtr(NULL)
        {
            m_statusMgrPtr = StatusManager::RouteC::instance();
        };
        ~InterfaceFacade::InterfaceFacade(){};

        void InterfaceFacade::registerForStatus(int id, int address, void* ptr, StatusManager::RouteC::MessageTypeACallback callback){
            if(NULL !=m_statusMgrPtr ){
                m_statusMgrPtr->registerForStatus(id,address,ptr,callback);
            }
        }

    }

The status manager is then responsible for taking incoming messages and passing it back to the DeviceModelA class so that the method:

 void DeviceTypeA::processMessageTypeA_Impl(const boost::shared_ptr<MessageAbstraction::MessageTypeA>& msgPtr)

... can process what to do with the incoming message.

#include "StatusManager_RouteC.hpp"

namespace StautsManager {

    RouteC::RouteC(){};
    ~RouteC::RouteC(){};

    void RouteC::registerForStatus(int id, int address,void* ptr,MessageTypeACallback callback){
    //do stuff here
    }

    void RouteC::registerForStatus(int id, int address,void* ptr,MessageTypeBCallback callback){
    //do stuff here
    }

}

/*
RouteC.hpp
*/

namespace StatusManager {

class RouteC{
    public:
        RouteC::RouteC();
        ~RouteC::RouteC();

        typedef void (*MessageTypeACallback)(void*, const boost::shared_ptr<MessageAbstraction::MessageTypeA>& msg);
        typedef void (*MessageTypeBCallback)(void*, const boost::shared_ptr<MessageAbstraction::MessageTypeB>& msg);

        void RouteC::registerForStatus(int id, int address,void* ptr,MessageTypeACallback callback){
        //do stuff here
        }

        void RouteC::registerForStatus(int id, int address,void* ptr,MessageTypeBCallback callback){
        //do stuff here
        }
}

}


问:
How to Use Malloc on a 2D Array and Not Overwrite Previous Values in C++
I am trying to use malloc to allocate the inner section of a dynamically allocated 2D array. I know that vectors and new are better but I am required to use malloc and realloc. I start off with two variables.

```<code>buffer_count = 0
  buffer_size = 3
</code>```

I then create the 2D array of size [3][26](each inner array just has to be of size 26).

Here is that creation:

```<code>int ** array_creation (){
int ** arr = (int **) malloc(buffer_size * sizeof(int *));
            for(int i=0;i<buffer_size;i++){
                arr[i] = (int *)malloc(26 * sizeof(int));
            }
}
</code>```

Every time I add to the next array location I increase the buffer_count. When the count is equal to the size, I am trying to double the size of the outer part of the array.

```<code>if(buffer_count >= buffer_size){
            buffer_size = buffer_size * 2;
            arr = (int **) realloc(*arr, buffer_size *sizeof(int));
            for(int i=0;i<buffer_size;i++){
                    arr[i] = (int *)malloc(26 * sizeof(int));
            }
</code>```

This code above will run but it will obviously write over the first 3 since I am using malloc in the inner for loop.

Any attempt at only adding from say buffer_count / 2 and so on and make the inner for loop arr[I] be something like arr[buffer_size/2] to start from the end of what was already allocated to not overwrite it I get a Segmentation Error. I have also tried doing something like:

```<code>if(arr[i] == NULL){
   //write to array
}
</code>```

That also does not work. Like I said, I know the draw backs of using malloc in C++ but I am required to here. Thank you

Body:
I am trying to use malloc to allocate the inner section of a dynamically allocated 2D array. I know that vectors and new are better but I am required to use malloc and realloc. I start off with two variables.

buffer_count = 0
  buffer_size = 3

I then create the 2D array of size [3][26](each inner array just has to be of size 26).

Here is that creation:

int ** array_creation (){
int ** arr = (int **) malloc(buffer_size * sizeof(int *));
            for(int i=0;i<buffer_size;i++){
                arr[i] = (int *)malloc(26 * sizeof(int));
            }
}

Every time I add to the next array location I increase the buffer_count. When the count is equal to the size, I am trying to double the size of the outer part of the array.

if(buffer_count >= buffer_size){
            buffer_size = buffer_size * 2;
            arr = (int **) realloc(*arr, buffer_size *sizeof(int));
            for(int i=0;i<buffer_size;i++){
                    arr[i] = (int *)malloc(26 * sizeof(int));
            }

This code above will run but it will obviously write over the first 3 since I am using malloc in the inner for loop.

Any attempt at only adding from say buffer_count / 2 and so on and make the inner for loop arr[I] be something like arr[buffer_size/2] to start from the end of what was already allocated to not overwrite it I get a Segmentation Error. I have also tried doing something like:

if(arr[i] == NULL){
   //write to array
}

That also does not work. Like I said, I know the draw backs of using malloc in C++ but I am required to here. Thank you


问:
How to clean PKCanvas from strokes when I leave the screen?
I have a basic app, a Main View with links to Drawing View. When I go to the Drawing View №1 and paint something with Apple Pencil, then go back to Main View, then go back to Drawing View №1 - I still see my painting. It stayed in the memory.

Question: What is a proper way to free the memory from PKCanvas and it's strokes when leaving the view?

I know I can "remove" the drawing by assigning canvasView.drawing = PKDrawing() a new blank drawing. But does it really solve the problem of keeping junk in the memory?

Here is my bare-minimum code:

```<code>import SwiftUI
import PencilKit

struct ContentView: View {
    var body: some View {
        NavigationStack {
            VStack {
                NavigationLink(destination: DrawingView()) {
                    Text("Go to Drawing #1")
                }
                .padding()
                NavigationLink(destination: DrawingView()) {
                    Text("Go to Drawing #2")
                }
                .padding()
            }
        }
    }
}

struct DrawingView: View {
    @State private var canvasView = PKCanvasView()
    var body: some View {
        PKCanvasViewRepresentable(canvasView: $canvasView)
            .frame(width: 500, height: 500)
            .border(Color.blue)
    }
}
struct PKCanvasViewRepresentable: UIViewRepresentable {
    @Binding var canvasView: PKCanvasView

    func makeUIView(context: Context) -> PKCanvasView {
        canvasView.tool = PKInkingTool(.pen, color: .black, width: 26)
        canvasView.becomeFirstResponder()
        canvasView.delegate = context.coordinator

        return canvasView
    }

    func updateUIView(_ canvasView: PKCanvasView, context: Context) { }

    func makeCoordinator() -> Coordinator {
        Coordinator(self)
    }

    class Coordinator: NSObject, PKCanvasViewDelegate, UIPencilInteractionDelegate {
        var canvas: PKCanvasViewRepresentable

        init(_ canvas: PKCanvasViewRepresentable) {
            self.canvas = canvas
        }

        func canvasViewDrawingDidChange(_ canvasView: PKCanvasView) {
            print("canvasViewDrawingDidChange()")
        }
    }
}
</code>```

Body:
I have a basic app, a Main View with links to Drawing View. When I go to the Drawing View №1 and paint something with Apple Pencil, then go back to Main View, then go back to Drawing View №1 - I still see my painting. It stayed in the memory.

Question: What is a proper way to free the memory from PKCanvas and it's strokes when leaving the view?

I know I can "remove" the drawing by assigning canvasView.drawing = PKDrawing() a new blank drawing. But does it really solve the problem of keeping junk in the memory?

Here is my bare-minimum code:

import SwiftUI
import PencilKit

struct ContentView: View {
    var body: some View {
        NavigationStack {
            VStack {
                NavigationLink(destination: DrawingView()) {
                    Text("Go to Drawing #1")
                }
                .padding()
                NavigationLink(destination: DrawingView()) {
                    Text("Go to Drawing #2")
                }
                .padding()
            }
        }
    }
}

struct DrawingView: View {
    @State private var canvasView = PKCanvasView()
    var body: some View {
        PKCanvasViewRepresentable(canvasView: $canvasView)
            .frame(width: 500, height: 500)
            .border(Color.blue)
    }
}
struct PKCanvasViewRepresentable: UIViewRepresentable {
    @Binding var canvasView: PKCanvasView

    func makeUIView(context: Context) -> PKCanvasView {
        canvasView.tool = PKInkingTool(.pen, color: .black, width: 26)
        canvasView.becomeFirstResponder()
        canvasView.delegate = context.coordinator

        return canvasView
    }

    func updateUIView(_ canvasView: PKCanvasView, context: Context) { }

    func makeCoordinator() -> Coordinator {
        Coordinator(self)
    }

    class Coordinator: NSObject, PKCanvasViewDelegate, UIPencilInteractionDelegate {
        var canvas: PKCanvasViewRepresentable

        init(_ canvas: PKCanvasViewRepresentable) {
            self.canvas = canvas
        }

        func canvasViewDrawingDidChange(_ canvasView: PKCanvasView) {
            print("canvasViewDrawingDidChange()")
        }
    }
}


问:
How do I resize the text to "Shape to fit text" in Google Slides using AppScript?

I have been trying to resize the rendered text to auto-fit, I searched through the docs, and videos but no luck. Would really appreciate any help.

Gooogle AppScript Docs

The updateTextAutoFit function isn't working. The API is returning this error Failed with error API call to slides.presentations.batchUpdate failed with error: Invalid requests[0].updateShapeProperties: The object (SLIDES_API1782835896_0) could not be found.

function updateTextAutoFit(presentationId: string, objectId: string) {
  // You can specify the ID to use for the slide, as long as it's unique.
  const requests: GoogleAppsScript.Slides.Schema.Request[] = [
    {
      updateShapeProperties: {
        objectId: objectId,
        fields: "autofit",
        shapeProperties: {
          // @ts-ignore
          autofit: {
            autofitType: "SHAPE_AUTOFIT",
          },
        },
        // 'slideLayoutReference': {
        //   'predefinedLayout': 'TITLE_AND_TWO_COLUMNS'
        // }
      },
    },
  ];
  try {
    const slide = Slides.Presentations?.batchUpdate(
      { requests: requests },
      presentationId
    );
    return slide;
  } catch (e: any) {
    // TODO (developer) - Handle Exception
    Logger.log("Failed with error %s", e.message);
  }
}

const titleText = createTextBox({
  slide,
  text: title,
  fontSize: 28,
  isBold: true,
  position: titlePosition,
  presentationId,
});

updateTextAutoFit(presentationId, id);

```