问:
SQL Server OPENJSON read nested JSON same key array
I am following the idea from Ed.Schavelev on article 'SQL Server OPENJSON read nested json'. But I need instead of repeating the rows I wanted them (4) to be in the columns. Is this possible?

I have tried as below:

```<code>DECLARE @json NVARCHAR(MAX)
SET @json =
  N'[

   {
      "EmployeeScheduleXRefCode":"#DF_10212",
      "EmployeeXRefCode":"7274",
      "TimeStart":"2022-10-31T05:30:00",
      "TimeEnd":"2022-10-31T15:30:00",
      "Published":false,
      "Breaks":[

      ],
      "Activities":[

      ],
      "Skills":[

      ],
      "LaborMetrics":[
         {
            "CodeXRefCode":"MEDIUM",
            "TypeXRefCode":"ACUITY_LM"
         },
         {
            "CodeXRefCode":"ATA",
            "TypeXRefCode":"EMPLOYEE_TYPE_LM"
         },
         {
            "CodeXRefCode":"BM02KR",
            "TypeXRefCode":"TEAM_NAME_LM"
         },
         {
            "CodeXRefCode":"AV_LM",
            "TypeXRefCode":"JOB_TYPE_LM"
         }
      ],
      "Segments":[

      ]
   },
   {
      "EmployeeScheduleXRefCode":"#DF_10200",
      "EmployeeXRefCode":"7269",
      "TimeStart":"2022-10-31T05:30:00",
      "TimeEnd":"2022-10-31T15:30:00",
      "Published":false,
      "Breaks":[

      ],
      "Activities":[

      ],
      "Skills":[

      ],
      "LaborMetrics":[
         {
            "CodeXRefCode":"MEDIUM",
            "TypeXRefCode":"ACUITY_LM"
         },
         {
            "CodeXRefCode":"ATA",
            "TypeXRefCode":"EMPLOYEE_TYPE_LM"
         },
         {
            "CodeXRefCode":"BM01KR",
            "TypeXRefCode":"TEAM_NAME_LM"
         },
         {
            "CodeXRefCode":"AV_LM",
            "TypeXRefCode":"JOB_TYPE_LM"
         }
      ],
      "Segments":[

      ]
   }
 ]'

SELECT Shifts.*,LaborMetrics.* FROM
 OPENJSON ( @json )
WITH (
              EmployeeScheduleXRefCode   varchar(200) '$.EmployeeScheduleXRefCode' ,
              EmployeeXRefCode     varchar(200)     '$.EmployeeXRefCode',
              TimeStart Datetime '$.TimeStart',
              TimeEnd Datetime '$.TimeEnd',
              LaborMetrics nvarchar(max) as json
 ) as Shifts
 cross apply openjson (Shifts.LaborMetrics)
 with
(
    CodeXRefCode nvarchar(100),
    TypeXRefCode nvarchar(100)
) as LaborMetrics

</code>```

But the result is repeating 4 rows and I want them to have them in 4 different columns in a single row.

Body:
I am following the idea from Ed.Schavelev on article 'SQL Server OPENJSON read nested json'. But I need instead of repeating the rows I wanted them (4) to be in the columns. Is this possible?

I have tried as below:

DECLARE @json NVARCHAR(MAX)
SET @json =
  N'[

   {
      "EmployeeScheduleXRefCode":"#DF_10212",
      "EmployeeXRefCode":"7274",
      "TimeStart":"2022-10-31T05:30:00",
      "TimeEnd":"2022-10-31T15:30:00",
      "Published":false,
      "Breaks":[

      ],
      "Activities":[

      ],
      "Skills":[

      ],
      "LaborMetrics":[
         {
            "CodeXRefCode":"MEDIUM",
            "TypeXRefCode":"ACUITY_LM"
         },
         {
            "CodeXRefCode":"ATA",
            "TypeXRefCode":"EMPLOYEE_TYPE_LM"
         },
         {
            "CodeXRefCode":"BM02KR",
            "TypeXRefCode":"TEAM_NAME_LM"
         },
         {
            "CodeXRefCode":"AV_LM",
            "TypeXRefCode":"JOB_TYPE_LM"
         }
      ],
      "Segments":[

      ]
   },
   {
      "EmployeeScheduleXRefCode":"#DF_10200",
      "EmployeeXRefCode":"7269",
      "TimeStart":"2022-10-31T05:30:00",
      "TimeEnd":"2022-10-31T15:30:00",
      "Published":false,
      "Breaks":[

      ],
      "Activities":[

      ],
      "Skills":[

      ],
      "LaborMetrics":[
         {
            "CodeXRefCode":"MEDIUM",
            "TypeXRefCode":"ACUITY_LM"
         },
         {
            "CodeXRefCode":"ATA",
            "TypeXRefCode":"EMPLOYEE_TYPE_LM"
         },
         {
            "CodeXRefCode":"BM01KR",
            "TypeXRefCode":"TEAM_NAME_LM"
         },
         {
            "CodeXRefCode":"AV_LM",
            "TypeXRefCode":"JOB_TYPE_LM"
         }
      ],
      "Segments":[

      ]
   }
 ]'

SELECT Shifts.*,LaborMetrics.* FROM
 OPENJSON ( @json )
WITH (
              EmployeeScheduleXRefCode   varchar(200) '$.EmployeeScheduleXRefCode' ,
              EmployeeXRefCode     varchar(200)     '$.EmployeeXRefCode',
              TimeStart Datetime '$.TimeStart',
              TimeEnd Datetime '$.TimeEnd',
              LaborMetrics nvarchar(max) as json
 ) as Shifts
 cross apply openjson (Shifts.LaborMetrics)
 with
(
    CodeXRefCode nvarchar(100),
    TypeXRefCode nvarchar(100)
) as LaborMetrics

But the result is repeating 4 rows and I want them to have them in 4 different columns in a single row.


来源: stackexchange

问:
How do I keep the context box and sidebar level?
I'm kind of getting back into coding after not touching it since high school, and to practice I'm making a webpage for myself. I'm trying to have a sidebar and content box, however when the content box gets filled with text, the sidebar moves down. How can I keep both boxes stuck to the top? Image here

In the CSS file I tried position: sticky, fixed, relative, etc but none of those did what I needed it to do.

ContentLicense: CC BY-SA 4.0


问:
Symbolic equations in Kotlin
How can I solve symbolic equations in kotlin.
Like in sympy I need to know how can i solve an equation like this one 2x-3=67. Just an example.

I need to know please.

Title: Symbolic equations in Kotlin


问:
what is best approach to design multi-part Powershell script (and avoid using invoke-expression)
I'm trying to redesign current script, which is "meta-script" (consists of multiple subscript parts, calling each other in turn).
First one is main runner.ps1 getting some external data, then loading definitions.json, with following structure:

```<code>[
   {
    "script": "modules/module1.ps1",
    "name":"some script name",
    "comment":"some comment here"
   },
    ...
]
</code>```

Then runner.ps1 converts external data to somedata.json, outputs it to file, and calls each module from definitions.json with invoke-expression, passing path to somedata.json to the module.

Module loads json, convert it back to array of objects, and doing something with it. After module finishes its work, it converts results of work to json, and returns path to that json to runner.ps1.

After all modules finish their work, runner.ps1 collects all data, convert it from json to some objects, reformats it and emails me with results and comments.

The system works, but using invoke-expression is considered bad practice (and I understand why), but I can't find better approach to "meta-script" problem. Dot-sourcing doesn't seem to be better, because it doesn't prevent "sourcecode of trusted script changed" problem, which I think is root reason why invoke-expression is bad.

Body:
I'm trying to redesign current script, which is "meta-script" (consists of multiple subscript parts, calling each other in turn).
First one is main runner.ps1 getting some external data, then loading definitions.json, with following structure:

[
   {
    "script": "modules/module1.ps1",
    "name":"some script name",
    "comment":"some comment here"
   },
    ...
]

Then runner.ps1 converts external data to somedata.json, outputs it to file, and calls each module from definitions.json with invoke-expression, passing path to somedata.json to the module.

Module loads json, convert it back to array of objects, and doing something with it. After module finishes its work, it converts results of work to json, and returns path to that json to runner.ps1.

After all modules finish their work, runner.ps1 collects all data, convert it from json to some objects, reformats it and emails me with results and comments.

The system works, but using invoke-expression is considered bad practice (and I understand why), but I can't find better approach to "meta-script" problem. Dot-sourcing doesn't seem to be better, because it doesn't prevent "sourcecode of trusted script changed" problem, which I think is root reason why invoke-expression is bad.


问:
Reverse perspective (Byzantine) projection, Vulkan
I am trying to render an object using inverse/revers/byzantine projection. To that effect I have tried both finding the formula or deriving it.

Scouting the web I found this:
https://math.stackexchange.com/questions/3677516/what-is-the-projection-matrix-of-reverse-byzantine-perspective

That seemed correct although the mathematical proof seems to be obtuse so I didn't follow it to the end. That lead me to this hard coded function (orinagl, regular perspective code added as a comment):

fn perspective(fov : Float, aspect : Float, z_near : Float, z_far : Float) -> Mat4
{
    // debug_assert!(aspect > Float::MIN_POSITIVE, "");

    // let tan_half_fovy = Float::tan(fov / 2.0);

    // let mut result = Mat4::zeros();
    // result[(0, 0)] = 1.0 / (aspect * tan_half_fovy);
    // result[(1, 1)] = 1.0 / (tan_half_fovy);
    // result[(2, 2)] = -(z_far + z_near) / (z_far - z_near);
    // result[(2, 3)] = -(2.0 * z_far * z_near) / (z_far - z_near);
    // result[(3, 2)] = -1.0;

    // return result;

    let mut result = Mat4::zeros();
    result[(0, 0)] = 2.0 / 800.0;
    result[(1, 1)] = 2.0 / 800.0;
    result[(2, 2)] = 2.0 / (z_far - z_near);
    result[(2, 3)] = -(z_far + z_near) / (z_far - z_near);
    result[(3, 2)] = 2.0 / (z_near - z_far);
    result[(3, 3)] = (z_far + z_near) / (z_near - z_far);

    return result;
}
```

This does not seem to work, when I try to render I get nothing, as if everything was clipped. I verified in renderdoc and no polygon is visible after the projection. So I tried re-deriving the matrix instead.

I got up to here:

where n, f are the far and near distance planes, w and h are the width and height of the screen.

The above is an orthogonal projection matrix. It maps z to the range [0, 1]. The issue now is, the regular perspective matrix sets the w component of the final answer to -z, that way the implicit division of homogeneous coordinates multiplies the entire final vector by (1/z), making things smaller the further away they are from the screen. But I want the opposite effect so I would need to set the coordinate to 1/z so that things get multiplied instead. But this cannot be done with matrix operations alone, and yet it seems to me it should be possible to express the inverse camera as a matrix.

Body:
I am trying to render an object using inverse/revers/byzantine projection. To that effect I have tried both finding the formula or deriving it.

Scouting the web I found this:
https://math.stackexchange.com/questions/3677516/what-is-the-projection-matrix-of-reverse-byzantine-perspective

That seemed correct although the mathematical proof seems to be obtuse so I didn't follow it to the end. That lead me to this hard coded function (orinagl, regular perspective code added as a comment):

fn perspective(fov : Float, aspect : Float, z_near : Float, z_far : Float) -> Mat4
{
    // debug_assert!(aspect > Float::MIN_POSITIVE, "");

    // let tan_half_fovy = Float::tan(fov / 2.0);

    // let mut result = Mat4::zeros();
    // result[(0, 0)] = 1.0 / (aspect * tan_half_fovy);
    // result[(1, 1)] = 1.0 / (tan_half_fovy);
    // result[(2, 2)] = -(z_far + z_near) / (z_far - z_near);
    // result[(2, 3)] = -(2.0 * z_far * z_near) / (z_far - z_near);
    // result[(3, 2)] = -1.0;

    // return result;

    let mut result = Mat4::zeros();
    result[(0, 0)] = 2.0 / 800.0;
    result[(1, 1)] = 2.0 / 800.0;
    result[(2, 2)] = 2.0 / (z_far - z_near);
    result[(2, 3)] = -(z_far + z_near) / (z_far - z_near);
    result[(3, 2)] = 2.0 / (z_near - z_far);
    result[(3, 3)] = (z_far + z_near) / (z_near - z_far);

    return result;
}

This does not seem to work, when I try to render I get nothing, as if everything was clipped. I verified in renderdoc and no polygon is visible after the projection. So I tried re-deriving the matrix instead.

I got up to here:

where n, f are the far and near distance planes, w and h are the width and height of the screen.

The above is an orthogonal projection matrix. It maps z to the range [0, 1]. The issue now is, the regular perspective matrix sets the w component of the final answer to -z, that way the implicit division of homogeneous coordinates multiplies the entire final vector by (1/z), making things smaller the further away they are from the screen. But I want the opposite effect so I would need to set the coordinate to 1/z so that things get multiplied instead. But this cannot be done with matrix operations alone, and yet it seems to me it should be possible to express the inverse camera as a matrix.


问:
Query in mongodb within two joined collections
If I have a collection of employees and a collection of their salaries. How can i find the employee with highest salary and lowest?

```<code>Employee:{
{id:123,
name:abc},
{id:456,
name:efg}
}

Salary:{
{id:123,
amount:100},
{id:456,
amount:200}
}
</code>```

Currently I am using node js and mongooses in my project.

Body:
If I have a collection of employees and a collection of their salaries. How can i find the employee with highest salary and lowest?

Employee:{
{id:123,
name:abc},
{id:456,
name:efg}
}

Salary:{
{id:123,
amount:100},
{id:456,
amount:200}
}

Currently I am using node js and mongooses in my project.


问:
Append A Frame (PNG) FFMPEG To existing video, Make changes all the video - libx264
I want to append a frame to existing video by using ffmpeg.

p0.png, p1.png and p2.png (3 frames)

by this command ffmpeg generate first video:

ffmpeg -framerate 4 -f image2 -s 1280x720 -i p%d.png -vcodec libx264 -b 80k test1.mp4

Then i want to append a frame to last of video, but total video in HEX-View will be changed. I use this command to append:

ffmpeg -framerate 4 -f image2 -s 1280x720 -t 1 -i new_pic.png -i test1.mp4 -vcodec libx264 -b 80k test2.mp4

Please see image below:

Please see this screen shot

But i want only append some hex code to end of first video....

Please help me. Thanks

I tried many commands. I did not get any results


问:
How to create parameter or date granularity in spotfire
Need to show the date(cases data) in yearly , quarterly, monthly and weekly

Tried to create parameters but unable to do


问:
Vimeo Video Api return only 9 videos
I am trying to get the list of videos on vimeo by api(php interface).
Although there are more than 30 videos in the folder (or other folder), the api always return only 9 videos in the result.
I have tried to set the “page” and “per_page” for several numbers or unset but the result didn’t be changed.

Could you please suggest what I should do?

https://api.vimeo.com/users/{user_id}/folders/{folder_id}/videos?page=1&per_page=100&fileds=name,link,uri

I hope get my all video in folder

Title: Vimeo Video Api return only 9 videos


问:
Trying to implement a JSON version migrator by implementing JsonConverter<T>
I am attempting to migrate serialized JSON objects using an abstract implementation of JsonConverter using Json.NET. The idea is that you would implement this class for any type that you would want to migrate versions. When that type is being deserialized, it calls one or more methods that modify the underlying JSON before using it to create the object.

```<code>public abstract class JsonMigrator<T> : JsonConverter<T> where T : class
{
    public override void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer)
    {
        writer.WriteValue(value);
    }

    public override T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer)
    {
        if (reader.TokenType == JsonToken.Null)
            return null;

        var item = JObject.Load(reader);

        //if this is a reference to an earlier object, return already created object
        if (item["$ref"] != null)
        {
            return serializer.ReferenceResolver.ResolveReference(serializer, (string)item["$ref"]) as T;
        }

        //call migration methods to transform json data
        var migratedData = PerformMigrations(item, serializer);

        var dataReader = migratedData.CreateReader();

        //this doesn't work, infinte recursion
        //var created = serializer.Deserialize(dataReader);

        //call constructor and then populate with data
        var created = ConstructObjectSomehow();
        serializer.Populate(dataReader, created);
        return created as T;
    }

    // Inspects object for Version property and performs each migration in succession to bring to current
    internal JToken PerformMigrations(JObject serializedData, JsonSerializer serializer)
    {
        var serializedVersion = serializedData.Value<int>("Version");

        for (int i = serializedVersion; i < OrderedMigrations.Count; i++)
        {
            serializedData = OrderedMigrations[i](serializedData, serializer);
        }

        return serializedData;
    }

    public abstract List<Func<JObject, JsonSerializer, JObject>> OrderedMigrations { get; }
}
</code>```

When I do it this way, it causes a SO because the converter just gets called recursively when I try to create the instance using the serializer.deserialize method. The constructor for the test class I'm using doesn't have a true parameterless constructor, so I can't restrict the generic type to new().

I am thinking that I can probably get it to work using reflection and/or Activator.CreateInstance. But I'm wondering if there is a more robust approach, since Json.Net is obviously already able to create instances of this object. (ie. it all works without this converter)

Body:
I am attempting to migrate serialized JSON objects using an abstract implementation of JsonConverter using Json.NET. The idea is that you would implement this class for any type that you would want to migrate versions. When that type is being deserialized, it calls one or more methods that modify the underlying JSON before using it to create the object.

public abstract class JsonMigrator<T> : JsonConverter<T> where T : class
{
    public override void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer)
    {
        writer.WriteValue(value);
    }

    public override T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer)
    {
        if (reader.TokenType == JsonToken.Null)
            return null;

        var item = JObject.Load(reader);

        //if this is a reference to an earlier object, return already created object
        if (item["$ref"] != null)
        {
            return serializer.ReferenceResolver.ResolveReference(serializer, (string)item["$ref"]) as T;
        }

        //call migration methods to transform json data
        var migratedData = PerformMigrations(item, serializer);

        var dataReader = migratedData.CreateReader();

        //this doesn't work, infinte recursion
        //var created = serializer.Deserialize(dataReader);

        //call constructor and then populate with data
        var created = ConstructObjectSomehow();
        serializer.Populate(dataReader, created);
        return created as T;
    }

    // Inspects object for Version property and performs each migration in succession to bring to current
    internal JToken PerformMigrations(JObject serializedData, JsonSerializer serializer)
    {
        var serializedVersion = serializedData.Value<int>("Version");

        for (int i = serializedVersion; i < OrderedMigrations.Count; i++)
        {
            serializedData = OrderedMigrations[i](serializedData, serializer);
        }

        return serializedData;
    }

    public abstract List<Func<JObject, JsonSerializer, JObject>> OrderedMigrations { get; }
}

When I do it this way, it causes a SO because the converter just gets called recursively when I try to create the instance using the serializer.deserialize method. The constructor for the test class I'm using doesn't have a true parameterless constructor, so I can't restrict the generic type to new().

I am thinking that I can probably get it to work using reflection and/or Activator.CreateInstance. But I'm wondering if there is a more robust approach, since Json.Net is obviously already able to create instances of this object. (ie. it all works without this converter)


问:
Jupyter Notebook won't start
Tried pip installing everything possible, does not work

```<code>(base) me518@PHS024636 ~ % jupyter notebook
</code>```

Traceback (most recent call last): File "/Users/me518/miniconda3/bin/jupyter-notebook", line 5, in <module> from notebook.notebookapp import main File "/Users/me518/miniconda3/lib/python3.9/site-packages/notebook/notebookapp.py", line 59, in <module> from tornado import httpserver File "/Users/me518/miniconda3/lib/python3.9/site-packages/tornado/httpserver.py", line 32, in <module> from tornado.http1connection import HTTP1ServerConnection, HTTP1ConnectionParameters File "/Users/me518/miniconda3/lib/python3.9/site-packages/tornado/http1connection.py", line 34, in <module> from tornado import iostream File "/Users/me518/miniconda3/lib/python3.9/site-packages/tornado/iostream.py", line 40, in <module> from tornado.netutil import ssl_wrap_socket, _client_ssl_defaults, _server_ssl_defaults ModuleNotFoundError: No module named 'tornado.netutil'

Title: Jupyter Notebook won't start

Body:
Tried pip installing everything possible, does not work

(base) me518@PHS024636 ~ % jupyter notebook

Traceback (most recent call last): File "/Users/me518/miniconda3/bin/jupyter-notebook", line 5, in <module> from notebook.notebookapp import main File "/Users/me518/miniconda3/lib/python3.9/site-packages/notebook/notebookapp.py", line 59, in <module> from tornado import httpserver File "/Users/me518/miniconda3/lib/python3.9/site-packages/tornado/httpserver.py", line 32, in <module> from tornado.http1connection import HTTP1ServerConnection, HTTP1ConnectionParameters File "/Users/me518/miniconda3/lib/python3.9/site-packages/tornado/http1connection.py", line 34, in <module> from tornado import iostream File "/Users/me518/miniconda3/lib/python3.9/site-packages/tornado/iostream.py", line 40, in <module> from tornado.netutil import ssl_wrap_socket, _client_ssl_defaults, _server_ssl_defaults ModuleNotFoundError: No module named 'tornado.netutil'


问:
Nextjs SSR data fetching error, returning UNICODE
Good day everyone,
I am building a project using React Tsx, Nextjs, Prisma and Swagger.

Problem : part of api fetched data is returned as unicode, whereas other data in the same api is fetched with no issues. Plus, the problematic data should be an array, but returned as string unicode.

Tests I've tried :

When yarn build and yarn start- checked Network tab and fetches all data perfectly fine.

When check localhost's swagger- all data fetched with no issues.

When checked dev domain's swagger- all data fetched with no issues.

When checked dev domain's website - partial api fetched data is returned as string unicode instead of an array
I've been searching for an answer or similar situations, but wasn't successful.
Could you please help me out if you've experienced a similar issue? Or give me an idea what to look for?
I really am lost atm :(

Thanks in advance, cheers!


问:
Get version of a source file

Possible Duplicate:

  GIT: determine revision based on a file

I have a source file (e.g. foo.py) which is under version control in git. The file I have is an old version. But I don't know which version. How can I get the version of this file?

Since git uses hash values, it should be possible to calculate the hash value and get the matching reversion.

Is there a way to get the closest match if the file was changed outside the git repository?

ContentLicense: CC BY-SA 3.0

Title: Get version of a source file


问:
Example of PSK in first handshake in TLS1.3 with JSSE (JDK11 or greater)
I've been trying to get an example working where the client passes a PSK ID to the server as part of the first TLS (TLS1.3) handshake and have been unsuccessful in doing so. I am using OpenJDK11.

I have been able to work with X.509 by setting the right key and trust managers, but haven't been able to get a working example of using PSK for 0-RTT on first handshake.

Any pointers of how one would go about setting the pskIdentities would be much appreciated. The PreSharedKeyExtension class seems to only set the PSK ID extension for resumptions and not the first handshake, hence my confusion.


问:
GTK: Make a TreeViewColumn fill the space when treeview is resized
What I want is having default column widths when start, allowing users to adjust the size if they want, and when the treeview is resized (i.e., window resized) make col1 grow/shrink to fill the space. I thought setting the ExpanderColumn would do it, but when I tried the code below, col2 filled the space. Why is it so?

    private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow"))
    {
        builder.Autoconnect(this);

        DeleteEvent += Window_DeleteEvent;

        treestore.AppendValues("God save the King", "UK");
        treestore.AppendValues("The Star-spangled banner", "US");

        var col1 = new TreeViewColumn();
        col1.Title = "Col1";
        col1.Sizing = TreeViewColumnSizing.Autosize;
        col1.FixedWidth = 300;
        col1.Resizable = true;
        col1.SortColumnId = 1;

        var col2 = new TreeViewColumn();
        col2.Title = "Col2";
        col2.Sizing = TreeViewColumnSizing.Fixed;
        col2.FixedWidth = 100;
        col2.Resizable = true;
        col2.SortColumnId = 2;

        var cell1 = new CellRendererText();
        col1.PackStart(cell1, true);
        col1.AddAttribute(cell1, "text", 0);

        var cell2 = new CellRendererText();
        col2.PackStart(cell2, true);
        col2.AddAttribute(cell2, "text", 1);

        tree.AppendColumn(col1);
        tree.AppendColumn(col2);
        tree.Model = treestore;
        tree.ExpanderColumn = col1;
    }
```
<p><img src="https://i.stack.imgur.com/2eWxw.png" alt="enter image description here" />
<img src="https://i.stack.imgur.com/v69oI.png" alt="enter image description here" /></p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
  <requires lib="gtk+" version="3.18"/>
  <object class="GtkWindow" id="MainWindow">
    <property name="can-focus">False</property>
    <property name="title" translatable="yes">Example Window</property>
    <property name="default-width">400</property>
    <property name="default-height">100</property>
    <child>
      <object class="GtkTreeView" id="tree">
        <property name="visible">True</property>
        <property name="can-focus">False</property>
        <property name="enable-grid-lines">both</property>
        <child internal-child="selection">
          <object class="GtkTreeSelection"/>
        </child>
      </object>
    </child>
  </object>
</interface>
</code>```

Body:
What I want is having default column widths when start, allowing users to adjust the size if they want, and when the treeview is resized (i.e., window resized) make col1 grow/shrink to fill the space. I thought setting the ExpanderColumn would do it, but when I tried the code below, col2 filled the space. Why is it so?

    private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow"))
    {
        builder.Autoconnect(this);

        DeleteEvent += Window_DeleteEvent;

        treestore.AppendValues("God save the King", "UK");
        treestore.AppendValues("The Star-spangled banner", "US");

        var col1 = new TreeViewColumn();
        col1.Title = "Col1";
        col1.Sizing = TreeViewColumnSizing.Autosize;
        col1.FixedWidth = 300;
        col1.Resizable = true;
        col1.SortColumnId = 1;

        var col2 = new TreeViewColumn();
        col2.Title = "Col2";
        col2.Sizing = TreeViewColumnSizing.Fixed;
        col2.FixedWidth = 100;
        col2.Resizable = true;
        col2.SortColumnId = 2;

        var cell1 = new CellRendererText();
        col1.PackStart(cell1, true);
        col1.AddAttribute(cell1, "text", 0);

        var cell2 = new CellRendererText();
        col2.PackStart(cell2, true);
        col2.AddAttribute(cell2, "text", 1);

        tree.AppendColumn(col1);
        tree.AppendColumn(col2);
        tree.Model = treestore;
        tree.ExpanderColumn = col1;
    }

<?xml version="1.0" encoding="UTF-8"?>

<interface>
  <requires lib="gtk+" version="3.18"/>
  <object class="GtkWindow" id="MainWindow">
    <property name="can-focus">False</property>
    <property name="title" translatable="yes">Example Window</property>
    <property name="default-width">400</property>
    <property name="default-height">100</property>
    <child>
      <object class="GtkTreeView" id="tree">
        <property name="visible">True</property>
        <property name="can-focus">False</property>
        <property name="enable-grid-lines">both</property>
        <child internal-child="selection">
          <object class="GtkTreeSelection"/>
        </child>
      </object>
    </child>
  </object>
</interface>


问:
Array of pointers can be accessed beyond last element C++
I am trying to create a 3*N array where N is specified at runtime.

```<code> int *array[3];
 int breadth;
 cin>>breadth;

    for(int i=0;i<3;i++)
        array[i] = new int[breadth];

    array[0][breadth-1] = 1;
    array[1][breadth-1] = 2;
    array[2][breadth-1] = 3;
    array[3][breadth-1] = 69; // how does this work

    cout<<array[3][breadth-1]<<endl;
</code>```

The output is 69 and I am surprised that the indicated line works even though the maximum size (3) has been exceeded. Does anyone know why that element is accessible?

I tried other sizes like 4N and 5N, with the same results

Body:
I am trying to create a 3*N array where N is specified at runtime.

 int *array[3];
 int breadth;
 cin>>breadth;

    for(int i=0;i<3;i++)
        array[i] = new int[breadth];

    array[0][breadth-1] = 1;
    array[1][breadth-1] = 2;
    array[2][breadth-1] = 3;
    array[3][breadth-1] = 69; // how does this work

    cout<<array[3][breadth-1]<<endl;

The output is 69 and I am surprised that the indicated line works even though the maximum size (3) has been exceeded. Does anyone know why that element is accessible?

I tried other sizes like 4N and 5N, with the same results


问:
Insight Cannot Find GCC Debug Info
Preface: I am out of my depth for debuggers and debug info, so the information may be straightforward, but a cursory google search returned nothing.

I am on x64 Windows, building a C program using MinGW64 and MSYS2. I have been debugging under MSYS2's gdb, but I wanted to spice up my debugging with a GUI debugger, making the process faster and bearable. I found and obtained a copy of Insight built for Windows for MinGW64. It works... but it does not pull debugging information! I'm getting raw x64 assembly (Motorola syntax too, ew), which doesn't make my debugging much easier.

The project I'm building is using an autotools build system. I can load symbols and source using the MSYS2's gdb when built with the appropriate flags. I would like to load symbols and source in Insight.

Versions for everything:

MSYS2: 2022-05-03

GCC: 12.2.0, Rev6

Insight: Built 2020-08-15 Obtained here, as insight-mingw64

MSYS2 GDB: 12.1

Insight GDB: 7.7

Various CFLAGS I've tried:

-Og -ggdb

-Og -gdwarf-2

-Og -g

-O0 -ggdb

-O0 -gdwarf-2

If the problem is intractible, I'm accepting suggestion comments for other GUI debuggers. My heart is not set on Insight.

Title: Insight Cannot Find GCC Debug Info


问:
Custom Context Menu in v-list vuetify
I have a couple of questions regarding implementing a custom Context Menu on the right click of a list item.

1st Question: I have this component that has

```<code><v-list>
  <menu-items
    v-for="record in Records"
    :key="record.id"
  >
  <template v-slot:someslotA>
  <template v-slot:someslotB>
 </menu-items
</v-list>

</code>```

And inside this menu-items script, I have Vuetify's v-list-item

```<code><v-list-item >
  <!-- icon -->
   <v-list-item-icon>
     <slot name="someslotA">

    </slot>
  </v-list-item-icon>
</v-list-item >
</code>```

Now I want to implement a custom Context Menu whenever any of the list items is right-clicked.
How do I achieve that?

2nd Question: Let's say I encapsulate this code more and add another component on top of the menu-item component. For example

```<code> <my-list
   :records="items"
 ></my-list>
</code>```

And now my list contains the menu-item component code. eg my-list context

```<code><v-list>
 <menu-items
    v-for="record in Records"
    :key="record.id"
  >
  <template v-slot:someslotA>
  <template v-slot:someslotB>
 </menu-items
</v-list>

</code>```

So can I now implement Custom Context Menu on the parent component (my-list) or can it only come with

```<code><menu-items
        v-for="record in Records"
        :key="record.id"
      >
</code>```

Title: Custom Context Menu in v-list vuetify

Body:
I have a couple of questions regarding implementing a custom Context Menu on the right click of a list item.

1st Question: I have this component that has

<v-list>
  <menu-items
    v-for="record in Records"
    :key="record.id"
  >
  <template v-slot:someslotA>
  <template v-slot:someslotB>
 </menu-items
</v-list>

And inside this menu-items script, I have Vuetify's v-list-item

<v-list-item >

   <v-list-item-icon>
     <slot name="someslotA">

    </slot>
  </v-list-item-icon>
</v-list-item >

Now I want to implement a custom Context Menu whenever any of the list items is right-clicked.
How do I achieve that?

2nd Question: Let's say I encapsulate this code more and add another component on top of the menu-item component. For example

 <my-list
   :records="items"
 ></my-list>

And now my list contains the menu-item component code. eg my-list context

<v-list>
 <menu-items
    v-for="record in Records"
    :key="record.id"
  >
  <template v-slot:someslotA>
  <template v-slot:someslotB>
 </menu-items
</v-list>

So can I now implement Custom Context Menu on the parent component (my-list) or can it only come with

<menu-items
        v-for="record in Records"
        :key="record.id"
      >


问:
While migrating project to angular 13 i get this Error: Type NgxsFeaturesModule does not have emod property
The above error is occurring on a specific scenario and that is When i run the project and select google bot as user agent in network condition tab of browser and refresh the page.

I am implementing ngxs/store, ngxs/router-plugin, ngxs/storage-plugin.

I upgraded the versions from 3.6.2 to 3.7.3 for three of packages above (Which have Angular 13 fix added --> see image attached).[Error ImageVersion Image](https://i.stack.imgur.com/5WQkG.jpg)


问:
Unhandled error Encountered an unhandled error in this Studio
```<code>TypeError: (0 , _schemaCreator.default) is not a function
    at Object. (/static/js/app.bundle.js:16698:43)
    at __webpack_require__ (/static/js/vendor.bundle.js:713:30)
    at fn (/static/js/vendor.bundle.js:118:20)
    at Object. (/static/js/app.bundle.js:36873:38)
    at __webpack_require__ (/static/js/vendor.bundle.js:713:30)
    at fn (/static/js/vendor.bundle.js:118:20)
    at Object. (/static/js/app.bundle.js:111222:26)
    at __webpack_require__ (/static/js/vendor.bundle.js:713:30)
    at fn (/static/js/vendor.bundle.js:118:20)
    at Object. (/static/js/app.bundle.js:109630:19)
</code>```

i cheked all my schema, i see no problem on it. yet thie error is still coming

Body:
TypeError: (0 , _schemaCreator.default) is not a function
    at Object. (/static/js/app.bundle.js:16698:43)
    at __webpack_require__ (/static/js/vendor.bundle.js:713:30)
    at fn (/static/js/vendor.bundle.js:118:20)
    at Object. (/static/js/app.bundle.js:36873:38)
    at __webpack_require__ (/static/js/vendor.bundle.js:713:30)
    at fn (/static/js/vendor.bundle.js:118:20)
    at Object. (/static/js/app.bundle.js:111222:26)
    at __webpack_require__ (/static/js/vendor.bundle.js:713:30)
    at fn (/static/js/vendor.bundle.js:118:20)
    at Object. (/static/js/app.bundle.js:109630:19)

i cheked all my schema, i see no problem on it. yet thie error is still coming


问:
HTML Table slightly wide of iPhone screen in portrait mode
I have a php served web page with a table which looks fine on the desktop. It also looks fine on the iPhone in landscape mode, but in portrait orientation on the iPhone the table is slightly off on the right side. I suspect it is because the table is using 100% width (although I tried 98%) and some left side padding is pushing it off to the right slightly. Also I read from another post about putting my  inside of a  but all that seemed to do was vertically misalign the Log Out link on the right from the text on the left side and not fix the table from rolling off the right side. By the way I can scroll the table on the iPhone to see it but I'd rather have it fit in the screen. Here's the HTML:</p>
```<code><html><head><title>Feed</title>
<meta name=viewport content='width=device-width, initial-scale=1.0'>
<link rel=icon type=image/x-icon href=/images/Icon.jpg></head>
<body><p1 style=text-align:left;><b>Feed for Paul</b><span style=float:right;><b>
<a href=webLogOut.php>Log Out</a></b></span></p1>
<p>Post <a href=webFindShow.php>TV Show or Movie</a>
<p><table border=1 style='width:98%'>
<tr><td colspan=3 line-height:4em><span style=text-align:left;vertical-align:middle;>Wednesday | 5 <img src=/images/goldStarOutlined.png alt=star width=20 height=20> | <a href=vote.php?user=1&feed_id=295&vote_type=1>1 <img src=/images/ThumbsUpGreen.png></a> <a href=vote.php?user=1&feed_id=295&vote_type=2>0 <img src=/images/ThumbsDownRed.png></a></span>
<span style=float:right;vertical-align:middle;>Paul</span></td></tr><tr><td style=width:185px;><img src=http://image.tmdb.org/t/p/w185/jeGtaMwGxPmQN5xM4ClnwPQcNQz.jpg></td><td>Very well done show. </td></tr>
</body></table></html>
</code>```

Body:
I have a php served web page with a table which looks fine on the desktop. It also looks fine on the iPhone in landscape mode, but in portrait orientation on the iPhone the table is slightly off on the right side. I suspect it is because the table is using 100% width (although I tried 98%) and some left side padding is pushing it off to the right slightly. Also I read from another post about putting my  inside of a  but all that seemed to do was vertically misalign the Log Out link on the right from the text on the left side and not fix the table from rolling off the right side. By the way I can scroll the table on the iPhone to see it but I'd rather have it fit in the screen. Here's the HTML:

<title>Feed</title>
<meta name=viewport content='width=device-width, initial-scale=1.0'>
<link rel=icon type=image/x-icon href=/images/Icon.jpg>
<p1 style=text-align:left;>Feed for Paul
Log Out</p1>

Post TV Show or Movie

Wednesday | 5  | 1  0
Paul

	Very well done show.


问:
Flutter doctor hangs at "Running pub upgrade..." during windows 10 install

Problem

During the windows install process found here https://docs.flutter.dev/get-started/install/windows, you need to run flutter doctor -v. Whenever I execute the command in an administrator Command Prompt or the flutter_console (with admin privileges) the command hangs on Running pub upgrade. I have waited over an hour for the command to execute with no luck. (See Pic below for results of running flutter doctor -v and flutter pub upgrade --verbose). I've installed flutter before, and the full flutter doctor installation took at most 1 min.

IMAGE LINK: Command Prompt Output from running flutter-doctor, seen here

IMAGE LINK: Command Prompt Output from running flutter-pub-upgrade --verbose, seen here

Any Help is greatly appreciated,
Thank You!

I will update with solution if I find one.

Environment

Windows 10.0.19

Flutter saved in c:\Dev\Flutter (Shouldn't need admin
privileges to access).

Located in Canada with stable internet.

Git for windows installed.

Setup my flutter\bin, Git\bin\cmd, Git\bin\git.exe and, C:\Windows\System32\WindowsPowerShell\v1.0\ environment variables.

What Ive Tried all ready

Tried manual downloading flutter_windows_3.3.9-stable.

Tried git Clone git clone https://github.com/flutter/flutter.git -b stable.

Tried deleting the flutter\bin\cache and re-running flutter.

Tried using a VPN.

Tried Rebooting in Safe Networking mode and running flutter doctor.

Tried flutter pub cache repair Same problem.

Tried just running flutter pub upgrade, Same problem.

Tried turning off windows defender.

Tried unzipping flutter stable download with 7-Zip and File Explorer.

Any Help is greatly appreciated,
Thank You!


问:
Json format in config.yml file
Can I have json string in config.yml
like this:</p>
```<code>json_A: {
        "e": "BBB",
        "kty": "AAA",
        "n": "123445"   }
</code>```

Title: Json format in config.yml file

Body:
Can I have json string in config.yml
like this:

json_A: {
        "e": "BBB",
        "kty": "AAA",
        "n": "123445"   }


问:
How to add empty object to existing object in jq
I have this input.

{
  "ver" : "2.4",
  "startDate"  : "2022-12-07T10:38:10+07:00",
  "disk" : {},
  "network" : {
    "ipv4" : {},
    "ipv6" : {}
  },
  "test" : {}
}
```
<p>I want to add empty object <code>/dev/sda</code> for example into <code>disk</code>. Below is ideal output.</p>
<pre class="lang-json prettyprint-override"><code>{
    "ver": "2.4",
    "startDate": "2022-12-07T10:38:10+07:00",
    "disk": {
        "/dev/sda": {}
    },
    "network": {
        "ipv4": {},
        "ipv6": {}
    },
    "test": {}
}
</code>```

I search the net but only found how to add element, not how to add empty object.

Body:
I have this input.

{
  "ver" : "2.4",
  "startDate"  : "2022-12-07T10:38:10+07:00",
  "disk" : {},
  "network" : {
    "ipv4" : {},
    "ipv6" : {}
  },
  "test" : {}
}

I want to add empty object /dev/sda for example into disk. Below is ideal output.

{
    "ver": "2.4",
    "startDate": "2022-12-07T10:38:10+07:00",
    "disk": {
        "/dev/sda": {}
    },
    "network": {
        "ipv4": {},
        "ipv6": {}
    },
    "test": {}
}

I search the net but only found how to add element, not how to add empty object.


问:
Database Not showing in app inspector(Android Studio)
I am trying to create a database for my project but when I created a database it's not showing in my app inspector.
I also tried with this answer but I am still faced with this.

How I fix this, Thank you.


问:
Flutter FormBuilding initial values and DateTime jsonEncode problem
I am using the formBuilder package to design a form for user to fill in, but I got 2 problems:

I set initialValues for form fields, but when I submit, formValues contains nothing, but if I change the value a little bit on the UI, formValues shows correct info.

if there is a DateTimePicker in the form, jsonEncode returns error: Converting object to an encodable object failed: Instance of 'DateTime'

Please help.

```<code>formValues['expirydate'] = formValues['expirydate'].toIso8601String();

</code>```

and this seem not work either

Body:
I am using the formBuilder package to design a form for user to fill in, but I got 2 problems:

I set initialValues for form fields, but when I submit, formValues contains nothing, but if I change the value a little bit on the UI, formValues shows correct info.

if there is a DateTimePicker in the form, jsonEncode returns error: Converting object to an encodable object failed: Instance of 'DateTime'

Please help.

formValues['expirydate'] = formValues['expirydate'].toIso8601String();

and this seem not work either


问:
Multiple SSH keys - invalid ssh key expired
When I try to log into the IP address
35.192.33.20 -> works
https://http://35.192.33.20/ -> doesn't work

The logs show an invalid ssh key error.

So, I ran this command on my gcp compute engine and it shows multiple ssh keys.

ls .ssh

The result showed multiple keys

google_compute_engine  google_compute_engine.pub  google_compute_known_hosts  home  home.pub  id_ed25519  id_ed25519.pub  ssh-key-dec6  ssh-key-dec6.pub  ssh-key-v1  ssh-key-v1.pub

I am hoping to connect to the server using ssh. Can anyone help me delete so many of these ssh keys?


问:
Adding a custom ROS package as dependency to another ROS package
I am new to ROS so apologies if it is obvious.
I have multiple ROS packages and currently I use them by linking them to my catkin workspace using symbolic links. What I want to do now is use one CMakeList to call and build the required ROS packages.
I have different ROS actions stored as packages in a folder and I link the main folder to the workspace and I can build it. I can even link each ROS action directory separately and build it. But when I use add_subdirectory in the main cmake file I want to call, it gives me an error that catkin should be listed as a buildtool dependency in package.xml, which it is.

My current folder structure looks like this

```<code>catkin_ws
--build
--devel
--logs
--src
  --ros_actions
    --action1
      --include
      --src
      --CMakeLists.txt
      --package.xml
    --action2
      --include
      --src
      --CMakeLists.txt
      --package.xml
  --main_file
    --config
    --launch
    --include
    --src
    --CMakeLists.txt
    --package.xml
</code>```

and I want to have something like

```<code>catkin_ws
--build
--devel
--logs
--src
  --main_file
    --actions
      --action1
        --include
        --src
        --CMakeLists.txt
        --package.xml
      --action2
        --include
        --src
        --CMakeLists.txt
        --package.xml
    --config
    --launch
    --include
    --src
    --CMakeLists.txt
    --package.xml
</code>```

I did try adding "ros_actions" in the CMakelist include_directories and find_package functions but failed.
Is there a way to add a custom ROS package as a dependency to another?

Thank you in advance.

Body:
I am new to ROS so apologies if it is obvious.
I have multiple ROS packages and currently I use them by linking them to my catkin workspace using symbolic links. What I want to do now is use one CMakeList to call and build the required ROS packages.
I have different ROS actions stored as packages in a folder and I link the main folder to the workspace and I can build it. I can even link each ROS action directory separately and build it. But when I use add_subdirectory in the main cmake file I want to call, it gives me an error that catkin should be listed as a buildtool dependency in package.xml, which it is.

My current folder structure looks like this

catkin_ws
--build
--devel
--logs
--src
  --ros_actions
    --action1
      --include
      --src
      --CMakeLists.txt
      --package.xml
    --action2
      --include
      --src
      --CMakeLists.txt
      --package.xml
  --main_file
    --config
    --launch
    --include
    --src
    --CMakeLists.txt
    --package.xml

and I want to have something like

catkin_ws
--build
--devel
--logs
--src
  --main_file
    --actions
      --action1
        --include
        --src
        --CMakeLists.txt
        --package.xml
      --action2
        --include
        --src
        --CMakeLists.txt
        --package.xml
    --config
    --launch
    --include
    --src
    --CMakeLists.txt
    --package.xml

I did try adding "ros_actions" in the CMakelist include_directories and find_package functions but failed.
Is there a way to add a custom ROS package as a dependency to another?

Thank you in advance.


问:
Is there a way to check for a set of four things in a list and then remove them all in python?
I am trying to write code to simulate something like placing a set of four cards down from the player’s. I want to be able to check for a set of four identical cards in a list and then remove them all from the list and make an external “point” value increase by one. Essentially like playing down a set in a game like go fish.

I can only figure out how to do it with 2 cards in the set. And in my deck there are no suits since the game is go fish and the suits dont matter for it. So i only need to figure it out for the rank of the cards


问:
FabricJS crashing on large screen
I am using fabricJS to load an SVG image on a screen. The weird part is annotating the diagrams on a less powerful laptop works fine but when i display the entire image on a large screen with a more powerful desktop it shows the crash icon with no error messages.

Could someone guide me on where do I start debugging this ?

Title: FabricJS crashing on large screen


问:
Pandas: Methods to populate a Column in a smaller DataFrame by checking multiple criteria in a Larger DataFrame?
I have two dataframes. The first dataframe is much smaller than the second (around 200 rows). I'm trying to add the T17, C19, C25, C30 and C21 columns from the second dataframe to the first dataframe ONLY when the cell meets the following criteria:

```<code>if merge_df\['Date Booked'\] \>= dom_rates_df\['begDate'\]
if merge_df\['Date Booked'\] \<= dom_rates_df\['endDate'\]
if (dom_rates_df\['rateSet'\] == merge_df\['Rate Zone'\]
</code>```

[DataFrames](https://i.stack.imgur.com/1wc1k.png)

The difficult appears to lie in the fact that the tables are not the same size. The multiple conditions has been to difficult to implement using lambda functions or the .map() method.

I have tried this:

```<code>
\[x for x in dom_rates_df\['T17'\] if merge_df\['Date Booked'\] \>= dom_rates_df\['begDate'\]\]# if merge_df\['Date Booked'\] \<= dom_rates_df\['endDate'\] if (dom_rates_df\['rateSet'\] == merge_df\['Rate Zone'\])\]
</code>```

And this:

```<code>def calculate_category(dom_rates_df, merge_df):
     category_row = dom_rates_df\[(dom_rates_df\["rateSet"\] == merge_df\["Rate Zone"\]) & (          dom_rates_df\["begDate"\] \<= merge_df\["Date Booked"\] & (dom_rates_df\['endDate'\] \>= merge_df\['Date Booked'\]))\]
     return (category_row\['T17'\])
</code>```

df.apply(lambda merge_df: calculate_category(dom_rates_df, merge_df), axis=1)

Body:
I have two dataframes. The first dataframe is much smaller than the second (around 200 rows). I'm trying to add the T17, C19, C25, C30 and C21 columns from the second dataframe to the first dataframe ONLY when the cell meets the following criteria:

if merge_df\['Date Booked'\] \>= dom_rates_df\['begDate'\]
if merge_df\['Date Booked'\] \<= dom_rates_df\['endDate'\]
if (dom_rates_df\['rateSet'\] == merge_df\['Rate Zone'\]

[DataFrames](https://i.stack.imgur.com/1wc1k.png)

The difficult appears to lie in the fact that the tables are not the same size. The multiple conditions has been to difficult to implement using lambda functions or the .map() method.

I have tried this:

\[x for x in dom_rates_df\['T17'\] if merge_df\['Date Booked'\] \>= dom_rates_df\['begDate'\]\]# if merge_df\['Date Booked'\] \<= dom_rates_df\['endDate'\] if (dom_rates_df\['rateSet'\] == merge_df\['Rate Zone'\])\]

And this:

def calculate_category(dom_rates_df, merge_df):
     category_row = dom_rates_df\[(dom_rates_df\["rateSet"\] == merge_df\["Rate Zone"\]) & (          dom_rates_df\["begDate"\] \<= merge_df\["Date Booked"\] & (dom_rates_df\['endDate'\] \>= merge_df\['Date Booked'\]))\]
     return (category_row\['T17'\])

df.apply(lambda merge_df: calculate_category(dom_rates_df, merge_df), axis=1)


问:
Kafka KRaft - Topic Deletion
When attempting to delete a topic using the kafka-topics.sh script, I can see that the topics in the log.dir are marked for deletion, but not all partitions belonging to the topic have been marked.

Eventually, the partitions marked for deletion are in fact deleted, but the others remain and the topic remains in the topic list.

I have set delete.topic.enable to true.

Is there a process to manually delete the topic when running in KRaft mode?  I thought I could:

Stop kafka

Manually delete the folders from log.dir

Restart kafka

However, I am wondering if I need to fire up kafka-metadata-shell.sh and run a rmr or rm command in there.

Any help or advice appreciated.  Thanks.

Title: Kafka KRaft - Topic Deletion


问:
post request from native javascript to nestjs using axios
The goal is to migrate code that makes a post request.

The code being migrated comes from Zapier.

The code is being migrated to a nestjs app.

Zapier uses vanilla javascript.

the code used in zapier that makes a request is the following::

```<code>const data = {
    "api_token": inputData.api_token,
    "call_type": "Inbound",
    "data": {
        "zip": inputData.zip,
        "phone": inputData.caller_number,
    },
    "placement_id": inputData.placement_id,
    "sub_3": inputData.uuid,
    "version": 17
};
//Send a ping to Buyer Distribution platform
const res = await fetch('URL', {
    method: 'POST',
    body: JSON.stringify(data),
    headers: {
        "Content-Type": "application/json"
    }
});
</code>```

The code below is my BEST attempt at making a post request in nestjs using HttpService..

note:: I removed "  method: 'POST', " because we are using the "post" function.
not sure if this is correct or not

```<code>  async postCallerInfoAndSetCallTransfers(incomingData) {
    const data = {
      api_token: incomingData.api_token,
      call_type: 'Inbound',
      data: {
        zip: incomingData.zip,
        phone: incomingData.number, // fix: verify if this is caller_number or number. on the original text that dylan send me it was caller_number
      },
      placement_id: incomingData.placement_id,
      sub_3: incomingData.uuid,
      version: 17,
    };
    const postConfig = {
      body: JSON.stringify(data),
      headers: {
        'Content-Type': 'application/json',
      },
    };

    const response = await this.httpService
      .post('URL', postConfig)
      .toPromise(); // fix: toPromise is deprecated

  }
</code>```

Did I translate that correctly?
I currently can't hit the API as in I cant hit the original URL because its down for maintenance

Body:
The goal is to migrate code that makes a post request.

The code being migrated comes from Zapier.

The code is being migrated to a nestjs app.

Zapier uses vanilla javascript.

the code used in zapier that makes a request is the following::

const data = {
    "api_token": inputData.api_token,
    "call_type": "Inbound",
    "data": {
        "zip": inputData.zip,
        "phone": inputData.caller_number,
    },
    "placement_id": inputData.placement_id,
    "sub_3": inputData.uuid,
    "version": 17
};
//Send a ping to Buyer Distribution platform
const res = await fetch('URL', {
    method: 'POST',
    body: JSON.stringify(data),
    headers: {
        "Content-Type": "application/json"
    }
});

The code below is my BEST attempt at making a post request in nestjs using HttpService..

note:: I removed "  method: 'POST', " because we are using the "post" function.
not sure if this is correct or not

  async postCallerInfoAndSetCallTransfers(incomingData) {
    const data = {
      api_token: incomingData.api_token,
      call_type: 'Inbound',
      data: {
        zip: incomingData.zip,
        phone: incomingData.number, // fix: verify if this is caller_number or number. on the original text that dylan send me it was caller_number
      },
      placement_id: incomingData.placement_id,
      sub_3: incomingData.uuid,
      version: 17,
    };
    const postConfig = {
      body: JSON.stringify(data),
      headers: {
        'Content-Type': 'application/json',
      },
    };

    const response = await this.httpService
      .post('URL', postConfig)
      .toPromise(); // fix: toPromise is deprecated

  }

Did I translate that correctly?
I currently can't hit the API as in I cant hit the original URL because its down for maintenance


问:
Content doesn't center when change size of text in textfield
enter image description here

In the first textfield, I set the size is 16 and everything is OK
But in the second textfield, I set the size if 30 and the content is not center

This is my code:

```<code>TextFormField(
  maxLines: 1,
  scrollPadding: EdgeInsets.zero,
  validator: validator,
  readOnly: readOnly ?? false,
  onChanged: onChanged,
  controller: controller,
  obscureText: obscureText ?? false,
  keyboardType: keyBoardType,
  // cursorHeight:  GeneralHelper.scale(context: context,height: obscureText == true ?30:17),
  style: TextStyle(
    color: Colors.black,
    fontSize: GeneralHelper.scale(
      context: context,
      // height: GeneralHelper.scale(context: context,height:17),
      **height: GeneralHelper.scale(context: context,height: obscureText == true ?30:17),**
      // height: 17,
    ),
  ),
</code>```

I have post an image above, and above code is TextFormFieldRounded, I used it at:

```<code>TextFormFieldRounded(
  radius: GeneralHelper.scale(context: context, height: 39.5),
  controller: txtPhoneNumber,
  hintStyle: TextStyle(
    color: const Color(0xFF81C59E),
    fontSize:
    GeneralHelper.scale(context: context, height: 16),
    fontWeight: FontWeight.w500,
  ),
  elevation: 0,
  backgroundColor: const Color(0xFFE3F4E1),
  borderSize: BorderSide(
      width: 0.5,
      style: BorderStyle.solid,
      color: Theme.of(context).colorScheme.primary),
  keyBoardType: TextInputType.phone,
  hintText: 'login_phone_number_hint'.tr,

  onChanged: onChangedTextField,
),
SizedBox(
  height: GeneralHelper.scale(context: context, height: 48),
),

TextFormFieldRounded(
  radius: GeneralHelper.scale(context: context, height: 39.5),
  backgroundColor: const Color(0xFFE3F4E1),
  elevation: 0,
  hintStyle: TextStyle(
    color: const Color(0xFF81C59E),
    fontSize:
        GeneralHelper.scale(context: context, height: 16),
    fontWeight: FontWeight.w500,
  ),
  controller: txtPassword,
  hintText: 'login_password_hint'.tr,
  keyBoardType: TextInputType.text,
  obscureText: !isShowPassword,
  borderSize: BorderSide(
      width: 0.5,
      style: BorderStyle.solid,
      color: Theme.of(context).colorScheme.primary),
),
</code>```

I think the problem is cursorHeight, but It's not.

Body:
enter image description here

In the first textfield, I set the size is 16 and everything is OK
But in the second textfield, I set the size if 30 and the content is not center

This is my code:

TextFormField(
  maxLines: 1,
  scrollPadding: EdgeInsets.zero,
  validator: validator,
  readOnly: readOnly ?? false,
  onChanged: onChanged,
  controller: controller,
  obscureText: obscureText ?? false,
  keyboardType: keyBoardType,
  // cursorHeight:  GeneralHelper.scale(context: context,height: obscureText == true ?30:17),
  style: TextStyle(
    color: Colors.black,
    fontSize: GeneralHelper.scale(
      context: context,
      // height: GeneralHelper.scale(context: context,height:17),
      **height: GeneralHelper.scale(context: context,height: obscureText == true ?30:17),**
      // height: 17,
    ),
  ),

I have post an image above, and above code is TextFormFieldRounded, I used it at:

TextFormFieldRounded(
  radius: GeneralHelper.scale(context: context, height: 39.5),
  controller: txtPhoneNumber,
  hintStyle: TextStyle(
    color: const Color(0xFF81C59E),
    fontSize:
    GeneralHelper.scale(context: context, height: 16),
    fontWeight: FontWeight.w500,
  ),
  elevation: 0,
  backgroundColor: const Color(0xFFE3F4E1),
  borderSize: BorderSide(
      width: 0.5,
      style: BorderStyle.solid,
      color: Theme.of(context).colorScheme.primary),
  keyBoardType: TextInputType.phone,
  hintText: 'login_phone_number_hint'.tr,

  onChanged: onChangedTextField,
),
SizedBox(
  height: GeneralHelper.scale(context: context, height: 48),
),

TextFormFieldRounded(
  radius: GeneralHelper.scale(context: context, height: 39.5),
  backgroundColor: const Color(0xFFE3F4E1),
  elevation: 0,
  hintStyle: TextStyle(
    color: const Color(0xFF81C59E),
    fontSize:
        GeneralHelper.scale(context: context, height: 16),
    fontWeight: FontWeight.w500,
  ),
  controller: txtPassword,
  hintText: 'login_password_hint'.tr,
  keyBoardType: TextInputType.text,
  obscureText: !isShowPassword,
  borderSize: BorderSide(
      width: 0.5,
      style: BorderStyle.solid,
      color: Theme.of(context).colorScheme.primary),
),

I think the problem is cursorHeight, but It's not.


问:
how to use wiris with ckeditor in a webpage
I am trying to use this code to add Math equations, formulas to a webpage:

```<code><!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="robots" content="noindex, nofollow">
  <title>Classic editor with default styles</title>
  <script charset="utf-8" src="ckeditor/ckeditor.js" type="text/javascript"></script>
</head>

<body>
  <textarea cols="80" id="contents" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="https://ckeditor.com/">CKEditor</a>.</p></textarea>

  <div id="contents_preview"></div>

<script type='text/javascript'>

CKEDITOR.on('instanceCreated', function (e) {
    document.getElementById( e.editor.name + '_preview').innerHTML = e.editor.getData();
    e.editor.on('change', function (ev) {
        document.getElementById( ev.editor.name + '_preview').innerHTML = ev.editor.getData();
        Print.postMessage(ev.editor.getData());
    });
});

    var mathElements = [
        'math',
        'maction',
        'maligngroup',
        'malignmark',
        'menclose',
        'merror',
        'mfenced',
        'mfrac',
        'mglyph',
        'mi',
        'mlabeledtr',
        'mlongdiv',
        'mmultiscripts',
        'mn',
        'mo',
        'mover',
        'mpadded',
        'mphantom',
        'mroot',
        'mrow',
        'ms',
        'mscarries',
        'mscarry',
        'msgroup',
        'msline',
        'mspace',
        'msqrt',
        'msrow',
        'mstack',
        'mstyle',
        'msub',
        'msup',
        'msubsup',
        'mtable',
        'mtd',
        'mtext',
        'mtr',
        'munder',
        'munderover',
        'semantics',
        'annotation',
        'annotation-xml',
        'mprescripts',
        'none'
    ];

CKEDITOR.plugins.addExternal('ckeditor_wiris', '../node_modules/@wiris/mathtype-ckeditor4/', 'plugin.js');

var config = {  height: 260,
      width: 700,
      removeButtons: 'PasteFromWord',
      extraPlugins: 'onchange,ckeditor_wiris',
                allowedContent: true,};

//CKEDITOR.replace('contents', config);

    CKEDITOR.replace('contents', { //eslint-disable-line
   extraPlugins: 'ckeditor_wiris',
   // Allow MathML content.
   allowedContent: true,
   toolbar: [
      { name: 'wirisplugins', items: ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] },
      // To avoid errors and have mathtype fully functional
      { name: 'others' },
   ],
   // language: 'de',
   // mathTypeParameters: {
   //   editorParameters: { language: 'es' }, // MathType config, including language
   // },
});

</script>

</body>

</html>
</code>```

but when I click on the wiris_formulaEditor nothing happens. What am I doing wrong. Any idea to make it work? Thanks.

Body:
I am trying to use this code to add Math equations, formulas to a webpage:

<!doctype html>

  <meta charset="utf-8">
  <meta name="robots" content="noindex, nofollow">
  <title>Classic editor with default styles</title>

  <textarea cols="80" id="contents" name="editor1" rows="10">
This is some sample text. You are using CKEditor.
</textarea>

but when I click on the wiris_formulaEditor nothing happens. What am I doing wrong. Any idea to make it work? Thanks.


问:
A InspectionFormProvider was used after being disposed
When I try to click the button using Provider this error appears:
A InspectionFormProvider was used after being disposed.
Once you have called dispose() on a InspectionFormProvider, it can no longer be used. What caused this error to appear?

```<code>ChangeNotifierProvider(
  create: (_) {
    return inspectionFormProvider;
  },
  Row(
    mainAxisSize: MainAxisSize.max,
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: [
      Padding(
        padding: const EdgeInsets.all(0.0),
        child: ElevatedButton.icon(
            icon: Icon(...),
            label: Text(...),
            onPressed: () {
              inspectionFormProvider.insertItem();
            },
          ),
      ),
      Consumer<InspectionFormProvider>(
        builder: (context, InspectionFormProvider, _) {
          return ListView.builder(
            itemCount: inspectionFormList.length,
            itemBuilder: (context, index) {
              return InspectionFormCard(...);
            },
          );
        },
      ),
    ],
  ),
)
</code>```

Body:
When I try to click the button using Provider this error appears:
A InspectionFormProvider was used after being disposed.
Once you have called dispose() on a InspectionFormProvider, it can no longer be used. What caused this error to appear?

ChangeNotifierProvider(
  create: (_) {
    return inspectionFormProvider;
  },
  Row(
    mainAxisSize: MainAxisSize.max,
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: [
      Padding(
        padding: const EdgeInsets.all(0.0),
        child: ElevatedButton.icon(
            icon: Icon(...),
            label: Text(...),
            onPressed: () {
              inspectionFormProvider.insertItem();
            },
          ),
      ),
      Consumer<InspectionFormProvider>(
        builder: (context, InspectionFormProvider, _) {
          return ListView.builder(
            itemCount: inspectionFormList.length,
            itemBuilder: (context, index) {
              return InspectionFormCard(...);
            },
          );
        },
      ),
    ],
  ),
)


问:
Sorting by last names with the same first letter
Im trying to write a code that takes a vector of full names, and then sorts by the last name only. To do this im using a selection sort and isolating the last name of each vector entry before comparing them to each other using .compare(). This worked for most names, but started to give me problems when there were 2+ last names with the same first letter as each other. How can I change my comparison to sort precisely based on each subsequent letter of a last name?

I tried using this bit of code to compare the last names:

```<code>if(iLastName.compare(minLastName) < 0) {
            min = i;
         }
</code>```

however, when two people have last names such as 'Mahon' and 'McFadden', the code isnt precise enough with its sorting and allows them to be in any order (depending on where they are in the original vector).

Body:
Im trying to write a code that takes a vector of full names, and then sorts by the last name only. To do this im using a selection sort and isolating the last name of each vector entry before comparing them to each other using .compare(). This worked for most names, but started to give me problems when there were 2+ last names with the same first letter as each other. How can I change my comparison to sort precisely based on each subsequent letter of a last name?

I tried using this bit of code to compare the last names:

if(iLastName.compare(minLastName) < 0) {
            min = i;
         }

however, when two people have last names such as 'Mahon' and 'McFadden', the code isnt precise enough with its sorting and allows them to be in any order (depending on where they are in the original vector).


问:
Zillow returns first 7 properties
Trying to make a long story short so I apologize in advance, feel free to ask more questions for clarity.
Essentially I am trying to make a web scraping script that takes info from Zillow and puts it into a pandas data frame so that I can learn both pandas and beautifulsoup4 in the process. I am trying to avoid using the Zillow API but it seems it might be my only option. So, when I scrape the location the user inputs, it only returns 7 properties. I was told this is because of the Javascript Zillow uses ("Lazy-loading" or "infinite scrolling".) Basically the other properties aren't loaded until the user scrolls. I tried using selenium instead of requests but I end up getting bot verification captcha'd. I tried using headers and everything but cant seem to figure out a solution other than the API.

Here's my code BEFORE using selenium (aka when it semi-worked):

```<code>from bs4 import BeautifulSoup
import pandas as pd
from uszipcode import SearchEngine
import requests, prettify

search = SearchEngine()

zipcode = input("What is your zipcode: ")
zipcode_info = search.by_zipcode(zipcode)

headers = {
    'accept':
    'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
    'accept-encoding' : 'en-US,en;0.8',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
}

with requests.Session() as session:
    url= "https://www.zillow.com/homes/for_sale/" + zipcode_info.major_city + "/"
    response = session.get(url, headers=headers)

soup = BeautifulSoup(response.content, 'html.parser')
soup.prettify()
df = pd.DataFrame()

address = list()
price = list()
bed_bath = list()
links = list()

properties = soup.find_all("li", attrs={"class": "ListItem-c11n-8-73-8__sc-10e22w8-0 srp__hpnp3q-0 enEXBq with_constellation"})
for li in properties:
    try:
        address.append(li.find("a", attrs = {"class": "StyledPropertyCardDataArea-c11n-8-73-8__sc-yipmu-0 lhIXlm property-card-link"}).text)
    except:
        pass
    try:
        price.append(li.find("span", attrs = {"data-test": "property-card-price"}).text)
    except:
        pass
    try:
        span = (li.find("span", attrs = {"class": "StyledPropertyCardHomeDetails-c11n-8-73-8__sc-1mlc4v9-0 jlVIIO"}))
        for subspan in span:
            bed_bath.append(subspan.find("b").text)

    except:
        pass
    try:
        links.append( (li.find("a", attrs = {"data-test": "property-card-link"}).get("href"))  )
    except:
        pass

df['Address'] = address
df['Price'] = price
df['Links'] = links
print (df)
</code>```

And the output is:

```<code>                                      Address     Price                                              Links
0        525 W River Dr, Pennsauken, NJ 08110  $259,900  https://www.zillow.com/homedetails/525-W-River...
1     7519 Remington, Merchantville, NJ 08109  $270,000  https://www.zillow.com/homedetails/7519-Reming...
2       2269 Marlon Ave, Pennsauken, NJ 08110  $220,000  https://www.zillow.com/homedetails/2269-Marlon...
3         8129 River Rd, Pennsauken, NJ 08110  $324,999  https://www.zillow.com/homedetails/8129-River-...
4  1653 Springfield Ave, Pennsauken, NJ 08110  $259,900  https://www.zillow.com/homedetails/1653-Spring...
5      5531 Jackson Ave, Pennsauken, NJ 08110  $265,000  https://www.zillow.com/homedetails/5531-Jackso...
6          8141 Stow Rd, Pennsauken, NJ 08110  $359,000  https://www.zillow.com/homedetails/8141-Stow-R...
7          2203 42nd St, Pennsauken, NJ 08110  $275,000  https://www.zillow.com/homedetails/2203-42nd-S...
</code>```

Title: Zillow returns first 7 properties

Body:
Trying to make a long story short so I apologize in advance, feel free to ask more questions for clarity.
Essentially I am trying to make a web scraping script that takes info from Zillow and puts it into a pandas data frame so that I can learn both pandas and beautifulsoup4 in the process. I am trying to avoid using the Zillow API but it seems it might be my only option. So, when I scrape the location the user inputs, it only returns 7 properties. I was told this is because of the Javascript Zillow uses ("Lazy-loading" or "infinite scrolling".) Basically the other properties aren't loaded until the user scrolls. I tried using selenium instead of requests but I end up getting bot verification captcha'd. I tried using headers and everything but cant seem to figure out a solution other than the API.

Here's my code BEFORE using selenium (aka when it semi-worked):

from bs4 import BeautifulSoup
import pandas as pd
from uszipcode import SearchEngine
import requests, prettify

search = SearchEngine()

zipcode = input("What is your zipcode: ")
zipcode_info = search.by_zipcode(zipcode)

headers = {
    'accept':
    'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
    'accept-encoding' : 'en-US,en;0.8',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
}

with requests.Session() as session:
    url= "https://www.zillow.com/homes/for_sale/" + zipcode_info.major_city + "/"
    response = session.get(url, headers=headers)

soup = BeautifulSoup(response.content, 'html.parser')
soup.prettify()
df = pd.DataFrame()

address = list()
price = list()
bed_bath = list()
links = list()

properties = soup.find_all("li", attrs={"class": "ListItem-c11n-8-73-8__sc-10e22w8-0 srp__hpnp3q-0 enEXBq with_constellation"})
for li in properties:
    try:
        address.append(li.find("a", attrs = {"class": "StyledPropertyCardDataArea-c11n-8-73-8__sc-yipmu-0 lhIXlm property-card-link"}).text)
    except:
        pass
    try:
        price.append(li.find("span", attrs = {"data-test": "property-card-price"}).text)
    except:
        pass
    try:
        span = (li.find("span", attrs = {"class": "StyledPropertyCardHomeDetails-c11n-8-73-8__sc-1mlc4v9-0 jlVIIO"}))
        for subspan in span:
            bed_bath.append(subspan.find("b").text)

    except:
        pass
    try:
        links.append( (li.find("a", attrs = {"data-test": "property-card-link"}).get("href"))  )
    except:
        pass

df['Address'] = address
df['Price'] = price
df['Links'] = links
print (df)

And the output is:

                                      Address     Price                                              Links
0        525 W River Dr, Pennsauken, NJ 08110  $259,900  https://www.zillow.com/homedetails/525-W-River...
1     7519 Remington, Merchantville, NJ 08109  $270,000  https://www.zillow.com/homedetails/7519-Reming...
2       2269 Marlon Ave, Pennsauken, NJ 08110  $220,000  https://www.zillow.com/homedetails/2269-Marlon...
3         8129 River Rd, Pennsauken, NJ 08110  $324,999  https://www.zillow.com/homedetails/8129-River-...
4  1653 Springfield Ave, Pennsauken, NJ 08110  $259,900  https://www.zillow.com/homedetails/1653-Spring...
5      5531 Jackson Ave, Pennsauken, NJ 08110  $265,000  https://www.zillow.com/homedetails/5531-Jackso...
6          8141 Stow Rd, Pennsauken, NJ 08110  $359,000  https://www.zillow.com/homedetails/8141-Stow-R...
7          2203 42nd St, Pennsauken, NJ 08110  $275,000  https://www.zillow.com/homedetails/2203-42nd-S...


问:
How can I call the 'key' column and make conditional statement (WHERE) with others on Wordpress WPCode Snippets

I have tried

```<code>$appointment_values = $wpdb->get_results("SELECT value FROM wp_e_submissions_values WHERE submission_id = '$appointments_arr->id' AND (key = \'bs_reason\' OR key = \'bs_dateofappointment\' OR key = \'bs_time\' OR key = \'bs_pa_givenname\' OR key = \'bs_pa_contactperson\' OR key = \'bs_pa_contactpersonnum\')");
</code>```

and

```<code>$appointment_values = $wpdb->get_results("SELECT value FROM wp_e_submissions_values WHERE submission_id = '$appointments_arr->id' AND key = 'bs_reason'");
</code>```

But nothing seems to be working, only the submission_id = '$appointments_arr->id' is working.

Really need some help on this one

```<code><?php
$logged_in_user_ID = get_current_user_id();

    if ($logged_in_user_ID == 0 || $logged_in_user_ID == 1) {
        // Return Nothing ...
        return;
    }

global $wpdb;
$appointments_ID = $wpdb->get_results("SELECT id, key FROM wp_e_submissions WHERE user_id = '$logged_in_user_ID'");

foreach ($appointments_ID as $appointments_arr) {
    $appointment_values = $wpdb->get_results("SELECT value FROM wp_e_submissions_values WHERE submission_id = '$appointments_arr->id' AND (key = \'bs_reason\' OR key = \'bs_dateofappointment\' OR key = \'bs_time\' OR key = \'bs_pa_givenname\' OR key = \'bs_pa_contactperson\' OR key = \'bs_pa_contactpersonnum\')");

    $appointment_values = $wpdb->get_results("SELECT value FROM wp_e_submissions_values WHERE submission_id = '$appointments_arr->id' AND key = 'bs_reason'");

    foreach ($appointment_values as $appointment_values_arr){
        echo $appointment_values_arr->value . "</br>";
    }
}

?>
</code>```

Body:
I have tried

$appointment_values = $wpdb->get_results("SELECT value FROM wp_e_submissions_values WHERE submission_id = '$appointments_arr->id' AND (key = \'bs_reason\' OR key = \'bs_dateofappointment\' OR key = \'bs_time\' OR key = \'bs_pa_givenname\' OR key = \'bs_pa_contactperson\' OR key = \'bs_pa_contactpersonnum\')");

and

$appointment_values = $wpdb->get_results("SELECT value FROM wp_e_submissions_values WHERE submission_id = '$appointments_arr->id' AND key = 'bs_reason'");

But nothing seems to be working, only the submission_id = '$appointments_arr->id' is working.

Really need some help on this one

<?php
$logged_in_user_ID = get_current_user_id();

    if ($logged_in_user_ID == 0 || $logged_in_user_ID == 1) {
        // Return Nothing ...
        return;
    }

global $wpdb;
$appointments_ID = $wpdb->get_results("SELECT id, key FROM wp_e_submissions WHERE user_id = '$logged_in_user_ID'");

foreach ($appointments_ID as $appointments_arr) {
    $appointment_values = $wpdb->get_results("SELECT value FROM wp_e_submissions_values WHERE submission_id = '$appointments_arr->id' AND (key = \'bs_reason\' OR key = \'bs_dateofappointment\' OR key = \'bs_time\' OR key = \'bs_pa_givenname\' OR key = \'bs_pa_contactperson\' OR key = \'bs_pa_contactpersonnum\')");

    $appointment_values = $wpdb->get_results("SELECT value FROM wp_e_submissions_values WHERE submission_id = '$appointments_arr->id' AND key = 'bs_reason'");

    foreach ($appointment_values as $appointment_values_arr){
        echo $appointment_values_arr->value . "
";
    }
}

?>


问:
Making pycurl request in asyncio websocket server setup
Currently, I have a simple websocket server that can handle recv and send operations. The code is as such.

async def recv_handler(websocket):
    while True:
        try:
            message = await websocket.recv()
            print(message)
        except Exception as e:
            print(e)
        await asyncio.sleep(0.01)

async def send_handler(websocket):
    while True:
        try:
            data = {
                "type": "send",
                "time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
            }
            await websocket.send(json.dumps(data))
        except Exception as e:
            print(e)
        await asyncio.sleep(0.01)

async def main(websocket):
    while True:
        recv_task = asyncio.create_task(recv_handler(websocket))
        send_task = asyncio.create_task(send_handler(websocket))
        await asyncio.gather(recv_task, send_task)

async def start_server():
    server = await websockets.serve(main, "", 3001)
    await server.wait_closed()

if __name__ == "__main__":
    asyncio.run(start_server())

```
<p>This successfully runs a server, hand can handle message sent from a client node.js application using websockets as well as send updates to the client node.js application periodically.</p>
<pre class="lang-js prettyprint-override"><code> // receive a message from the server
  socket.addEventListener("message", ({ data }) => {
    const packet = JSON.parse(data);
    switch (packet.type) {
      case "send":
        console.log(packet.time)
        break;
      default:
        break;
    }
  });

  // send message to server
  const onClickSend = () => {
    if (socket.readyState !== WebSocket.OPEN) {
      console.log("socket not open");
      return;
    } else {
      socket.send(JSON.stringify({
        type: "hello from client",
      }));
    }
  }
</code>```

Now, I want to include a blocking function call that sends a pycurl (or any http) request, then use the result of that pycurl request, package it into the json object, and send that to the client.

I have a sample pycurl requst that gets the weather from wttr.in

def getWeather():
    # Creating a buffer as the cURL is not allocating a buffer for the network response
    buffer = BytesIO()
    c = pycurl.Curl()
    #initializing the request URL
    c.setopt(c.URL, 'wttr.in/Beijing?format="%l:+\%c+%t+%T\\n"')
    #setting options for cURL transfer
    c.setopt(c.WRITEDATA, buffer)
    #setting the file name holding the certificates
    c.setopt(c.CAINFO, certifi.where())
    # perform file transfer
    c.perform()
    #Ending the session and freeing the resources
    c.close()

    #retrieve the content BytesIO
    body = buffer.getvalue()
    #decoding the buffer
    return body.decode('utf-8')
```
<p>So if we change data to include or weather,</p>
<pre class="lang-py prettyprint-override"><code>date = {
   "type" : "send",
   "weather" : getWeather(),
}
</code>```

and we can slightly change the node.js application case statement to print

case "send":
   console.log(packet.weather)
```

The problem with this, I believe, is that we are making a blocking request, but I don't know enough on how to fix the problem. Currently, I can make requests, but every time the "onClickSend" is called (by pressing a button in frontend", now, we get an error saying that the "socket not open", meaning the backend is no longer handling receive messages.

So how do I handle pycurl requests in asyncio-websocket program?

Body:
Currently, I have a simple websocket server that can handle recv and send operations. The code is as such.

async def recv_handler(websocket):
    while True:
        try:
            message = await websocket.recv()
            print(message)
        except Exception as e:
            print(e)
        await asyncio.sleep(0.01)

async def send_handler(websocket):
    while True:
        try:
            data = {
                "type": "send",
                "time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
            }
            await websocket.send(json.dumps(data))
        except Exception as e:
            print(e)
        await asyncio.sleep(0.01)

async def main(websocket):
    while True:
        recv_task = asyncio.create_task(recv_handler(websocket))
        send_task = asyncio.create_task(send_handler(websocket))
        await asyncio.gather(recv_task, send_task)

async def start_server():
    server = await websockets.serve(main, "", 3001)
    await server.wait_closed()

if __name__ == "__main__":
    asyncio.run(start_server())

This successfully runs a server, hand can handle message sent from a client node.js application using websockets as well as send updates to the client node.js application periodically.

 // receive a message from the server
  socket.addEventListener("message", ({ data }) => {
    const packet = JSON.parse(data);
    switch (packet.type) {
      case "send":
        console.log(packet.time)
        break;
      default:
        break;
    }
  });

  // send message to server
  const onClickSend = () => {
    if (socket.readyState !== WebSocket.OPEN) {
      console.log("socket not open");
      return;
    } else {
      socket.send(JSON.stringify({
        type: "hello from client",
      }));
    }
  }

Now, I want to include a blocking function call that sends a pycurl (or any http) request, then use the result of that pycurl request, package it into the json object, and send that to the client.

I have a sample pycurl requst that gets the weather from wttr.in

def getWeather():
    # Creating a buffer as the cURL is not allocating a buffer for the network response
    buffer = BytesIO()
    c = pycurl.Curl()
    #initializing the request URL
    c.setopt(c.URL, 'wttr.in/Beijing?format="%l:+\%c+%t+%T\\n"')
    #setting options for cURL transfer
    c.setopt(c.WRITEDATA, buffer)
    #setting the file name holding the certificates
    c.setopt(c.CAINFO, certifi.where())
    # perform file transfer
    c.perform()
    #Ending the session and freeing the resources
    c.close()

    #retrieve the content BytesIO
    body = buffer.getvalue()
    #decoding the buffer
    return body.decode('utf-8')

So if we change data to include or weather,

date = {
   "type" : "send",
   "weather" : getWeather(),
}

and we can slightly change the node.js application case statement to print

case "send":
   console.log(packet.weather)

The problem with this, I believe, is that we are making a blocking request, but I don't know enough on how to fix the problem. Currently, I can make requests, but every time the "onClickSend" is called (by pressing a button in frontend", now, we get an error saying that the "socket not open", meaning the backend is no longer handling receive messages.

So how do I handle pycurl requests in asyncio-websocket program?


问:
Columns not auto populating when importing CSV data on PgAdmin for PostgreSQL (On Windows)
I am on Windows. I created a database, went to the schemas tab on the database dropdown, and created a table. I entered in all of the info for the table. However, when I import a CSV file to the table, the columns of the table do not show up on the column tab. As a result, I cannot import the csv data. It will not even allow me enter in the column names myself.

This is the code I used to create a table:

```<code>CREATE TABLE table_name(column1 int, column2 varchar, column3 varchar, column4 int);
select * from table_name
</code>```

After, I clicked on the table I had made to import csv data. However, the columns will not autopopulate when I finished importing the csv data with a header, and UTF-8 encoding.

I reinstalled PgAdmin but it did not solve anything. I cannot enter in the column names myself as well. The column names of the table should be autogenerating but it is not working.

Body:
I am on Windows. I created a database, went to the schemas tab on the database dropdown, and created a table. I entered in all of the info for the table. However, when I import a CSV file to the table, the columns of the table do not show up on the column tab. As a result, I cannot import the csv data. It will not even allow me enter in the column names myself.

This is the code I used to create a table:

CREATE TABLE table_name(column1 int, column2 varchar, column3 varchar, column4 int);
select * from table_name

After, I clicked on the table I had made to import csv data. However, the columns will not autopopulate when I finished importing the csv data with a header, and UTF-8 encoding.

I reinstalled PgAdmin but it did not solve anything. I cannot enter in the column names myself as well. The column names of the table should be autogenerating but it is not working.


问:
C++ Multithreading vs Python and the GIL
I have several questions about how multithreading is handled in C++. It is known that in Python, thanks to the GIL, having multiple threads running at the "same time" is not truly correct. Only one thread can execute an action at the time. Is this the case with C++? If I use multithreading in C++ is it really simultaneously multithreaded? Can I have multiple threads really running at the same time?.

The other question is that, if I wrote a function in C++, say it is using multiple threads, and I wrap it to use it in Python, is the execution flow and performance of the function written in C++ affected by the GIL? How is this process handled behind the scenes? Will the threads initiated in the C++ function be affected by the Python GIL?

Also, is there any equivalent in C++ for the multiprocessing library in Python? Or all of this could be handled by the use of threads? Thanks in advance.

Parallelism and simultaneously multithreaded apps in C++ vs Python.


问:
Sending HTTPS request from DLL in C#
I really have no idea about the issue here.
I have a DLL to send requests to an HTTPS server and get response with below C# code

```<code>ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string result = await response.Content.ReadAsStringAsync();
</code>```

The DLL is with a standard interface. If this is called from my C# application, I got an error when read string from the response, sayiny "input string was not in a correct format". But if the URL is HTTP (not HTTPS) or it is called from a standard commercial application, it works.
Any help here is highly appreciated.

Title: Sending HTTPS request from DLL in C#

Body:
I really have no idea about the issue here.
I have a DLL to send requests to an HTTPS server and get response with below C# code

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string result = await response.Content.ReadAsStringAsync();

The DLL is with a standard interface. If this is called from my C# application, I got an error when read string from the response, sayiny "input string was not in a correct format". But if the URL is HTTP (not HTTPS) or it is called from a standard commercial application, it works.
Any help here is highly appreciated.


问:
How to call another saga function from current saga function in same saga file?
I have 2 saga function in my saga handler file.
*

function* fetchCustomDashboardCards - fetched the cards & saves cards in store

function* addPanelToCustomDashboard - adds a new card to customDashboard.

now I am invoking addPanelToCustomDashboard to add a card to dashboard, in which i make a api call to add the card. what i want here is, if my addPanelToCustomDashboard return success i want to call first saga fetchCustomDashboardCards to load the dashboard with newly added card.
could someone tell me how would i call the another saga function from current saga function?

below is the code of both saga functions -

```<code>1st saga function -

export function* fetchCustomDashboardCards(action) {
  const { botId } = action?.data;
  const fetchCardsUrl = urlConfig.fetchCustomDashboardCardsUrl(botId);

  try {
    const { status, data } = yield call(() => api.get(fetchCardsUrl));
    if (status === 200) {
      //dispatch action to save cards of custom dashboard
    } else {
      //dispatch action saying some error occured while fetching cards
      //remove this when apis start working
      yield put(customDashboarCardsFetched({ cards: data?.cards }));
    }
  } catch (error) {
    console.log('error occured while fetching custom dashboard cards');
    //remove this when apis start working
    yield put(customDashboarCardsFetched({ cards: [] }));
  }
}
</code>```
```<code>2nd saga function -

export function* addPanelToCustomDashboard(action) {
  const { botId } = action?.data;
  const addPanelUrl = urlConfig.addPanelToCustomDashboard(botId);

  try {
    const { status, data } = yield call(() =>
      api.post(addPanelUrl, {
        panelInfo: action?.data?.panelInfo
      })
    );
    if (status === 200) {
      ***//ON SUCCESS RELOAD DASHBOARD WITH NEWLY ADDED CARD BY CALLING 1st SAGA FUNCTION***

    } else {
      //dispatch action saying some error occured
      //remove this when apis start working
      yield put(panelAddedToCustomDashboard({ panel: action?.data?.panelInfo }));
    }
  } catch (error) {
    console.log('error occured while adding panel to custom dashboard');
    //remove this when apis start working
    yield put(panelAddedToCustomDashboard({ panel: action?.data?.panelInfo }));
  }
}
</code>```

Body:
I have 2 saga function in my saga handler file.
*

function* fetchCustomDashboardCards - fetched the cards & saves cards in store

function* addPanelToCustomDashboard - adds a new card to customDashboard.

now I am invoking addPanelToCustomDashboard to add a card to dashboard, in which i make a api call to add the card. what i want here is, if my addPanelToCustomDashboard return success i want to call first saga fetchCustomDashboardCards to load the dashboard with newly added card.
could someone tell me how would i call the another saga function from current saga function?

below is the code of both saga functions -

1st saga function -

export function* fetchCustomDashboardCards(action) {
  const { botId } = action?.data;
  const fetchCardsUrl = urlConfig.fetchCustomDashboardCardsUrl(botId);

  try {
    const { status, data } = yield call(() => api.get(fetchCardsUrl));
    if (status === 200) {
      //dispatch action to save cards of custom dashboard
    } else {
      //dispatch action saying some error occured while fetching cards
      //remove this when apis start working
      yield put(customDashboarCardsFetched({ cards: data?.cards }));
    }
  } catch (error) {
    console.log('error occured while fetching custom dashboard cards');
    //remove this when apis start working
    yield put(customDashboarCardsFetched({ cards: [] }));
  }
}

2nd saga function -

export function* addPanelToCustomDashboard(action) {
  const { botId } = action?.data;
  const addPanelUrl = urlConfig.addPanelToCustomDashboard(botId);

  try {
    const { status, data } = yield call(() =>
      api.post(addPanelUrl, {
        panelInfo: action?.data?.panelInfo
      })
    );
    if (status === 200) {
      ***//ON SUCCESS RELOAD DASHBOARD WITH NEWLY ADDED CARD BY CALLING 1st SAGA FUNCTION***

    } else {
      //dispatch action saying some error occured
      //remove this when apis start working
      yield put(panelAddedToCustomDashboard({ panel: action?.data?.panelInfo }));
    }
  } catch (error) {
    console.log('error occured while adding panel to custom dashboard');
    //remove this when apis start working
    yield put(panelAddedToCustomDashboard({ panel: action?.data?.panelInfo }));
  }
}


问:
git log command with changed file and branch names export file into csv
I want to export git log with all the branches from remote repository using git log command, when I'm executing below command my all the commit id, message, author all the details are getting exported into csv file but i want add one more column like branch name to identify which commit id belongs to which branch.

Command

```<code>echo "commit id,author,date,message" > report.csv
  git log --date=local master --source --pretty="%x40%h%x2C%an%x2C%ad%x2C%x22%s%x22%x2C" | tr "\n" " " | tr "@" "\n" >> report.csv
</code>```

output

If you open the above csv file you can see list commit id with author but i want add another column branch and add the respective commit id branch name as well.

Body:
I want to export git log with all the branches from remote repository using git log command, when I'm executing below command my all the commit id, message, author all the details are getting exported into csv file but i want add one more column like branch name to identify which commit id belongs to which branch.

Command

echo "commit id,author,date,message" > report.csv
  git log --date=local master --source --pretty="%x40%h%x2C%an%x2C%ad%x2C%x22%s%x22%x2C" | tr "\n" " " | tr "@" "\n" >> report.csv

output

If you open the above csv file you can see list commit id with author but i want add another column branch and add the respective commit id branch name as well.


问:
PowerBI Dynamic Columns slicers
I have tabular powerBI reports where few columns gets populated dynamically ( Like Year2022 , Year2023 ) within source query.

Report looks something like attache image.

Now Business Require slicer/Filter in such a way that He can filter those dynamic columns and he gets control to show and hide columns based on slicer selection with report.

I have find the solution but that is more suitable for filtering Static Columns , Is there any way we can filters Dynamic Columns through slicers .

Since Dynamic Columns numbers not fixed sometime ,

For one data refresh i can see Year2022, Year2023 and for other Year2025  ,Year2026.

Any solutions, direction will be appreciated

enter image description here

Title: PowerBI Dynamic Columns slicers