问:
Getting the same performance using timeit for pure pandas
I have a pure pandas function defined like this:

```<code>def pure_pandas(index):
    if index == 0:
        result = nycflights_flights_df.merge(nycflights_planes_df, how='left',\
    left_on='tailnum', right_on='tailnum')\
    .drop(['type', 'manufacturer','model', 'engines', 'engine'], axis=1)\
    .rename(columns = {'year_x':'year','year_y':'plane_year', 'seats':'plane_seats', \
    'speed':'plane_speed'})

    elif index == 1:
        result = nycflights_flights_df[['carrier', 'tailnum']].drop_duplicates()\
    .merge(nycflights_planes_df, how='inner', left_on='tailnum', right_on='tailnum')\
    .merge(nycflights_airlines_df, how='inner', left_on='carrier', right_on='carrier')\
    .assign(carrier = lambda x: x.pop('carrier'))\
    .sort_values(by=['tailnum','carrier'], ascending=[True,False])\
    .reset_index(drop=True)

    else:
        result = nycflights_flights_df[nycflights_flights_df['origin'] == 'EWR']\
    .merge(nycflights_weather_df[nycflights_weather_df['origin'] == 'EWR']\
    .groupby(['year','month','day'])[['temp', 'humid']]\
    .mean().reset_index()\
    .rename(columns = {'temp':'atemp','humid':'ahumid'}),\
    how='left', on=['year', 'month', 'day'])

    return result
</code>```

Which I call from timeit method like this for various runtimes:

```<code>Query_Type_list = [Group By & Sort', 'Join', 'Join',\
                   'Join & Group By']

def compare_queries(Query_Type_list, queries, no_of_times):

    if no_of_times == 10:
        print('Inside:',no_of_times)
        for i, qtl in zip(range(3),Query_Type_list):
            task = 'Task' + str(i+1)
            index.append(task)
            query_type_ls.append(qtl)

            pure_pandas_time = timeit.timeit(lambda: pure_pandas(i), number=no_of_times)
            pandas_query_time.append(pure_pandas_time)
            # print(pure_pandas_time)

        timeit_df = pd.DataFrame(list(zip(index,Query_Type_list,pandas_query_time)),\
                                 columns=['Query No','Query Type','Pure Pandas Time'])
        timeit_df['RUN TIMES'] = '10T'
        timeit_df['Key'] = timeit_df['RUN TIMES'] + timeit_df['Query No']
        return timeit_df
        del timeit_df

    elif no_of_times == 50:
        print('Inside:',no_of_times)
        for i, qtl in zip(range(3),Query_Type_list):
            task = 'Task' + str(i+1)
            index.append(task)
            query_type_ls.append(qtl)

            pure_pandas_time = timeit.timeit(lambda: pure_pandas(i), number=no_of_times)
            pandas_query_time.append(pure_pandas_time)
            # print(pure_pandas_time)

        timeit_df = pd.DataFrame(list(zip(index,Query_Type_list,pandas_query_time)),\
                                 columns=['Query No','Query Type','Pure Pandas Time'])
        timeit_df['RUN TIMES'] = '50T'
        timeit_df['Key'] = timeit_df['RUN TIMES'] + timeit_df['Query No']
        return timeit_df
        del timeit_df
    else:
        print('Do Nothing:')

# The calls for running 10 and 50 times:
timeit_df_10 = compare_queries(Query_Type_list, 10)

timeit_df_50 = compare_queries(Query_Type_list, 50)
</code>```

When I execute the above code, I am seeing the same results for 10 and 50 runs. If I segregate compare_queries (which is not the ideal way), then I see different results. Even the given code is not properly abstracted as I am checking for no_of_times parameter value in if condition of compare_queries function, I am unable to find the root cause. I dont want to repeat my code snippet for each run separately.

The whole point of doing it for different no_of_times is to check the performance of the same query.

Body:
I have a pure pandas function defined like this:

def pure_pandas(index):
    if index == 0:
        result = nycflights_flights_df.merge(nycflights_planes_df, how='left',\
    left_on='tailnum', right_on='tailnum')\
    .drop(['type', 'manufacturer','model', 'engines', 'engine'], axis=1)\
    .rename(columns = {'year_x':'year','year_y':'plane_year', 'seats':'plane_seats', \
    'speed':'plane_speed'})

    elif index == 1:
        result = nycflights_flights_df[['carrier', 'tailnum']].drop_duplicates()\
    .merge(nycflights_planes_df, how='inner', left_on='tailnum', right_on='tailnum')\
    .merge(nycflights_airlines_df, how='inner', left_on='carrier', right_on='carrier')\
    .assign(carrier = lambda x: x.pop('carrier'))\
    .sort_values(by=['tailnum','carrier'], ascending=[True,False])\
    .reset_index(drop=True)

    else:
        result = nycflights_flights_df[nycflights_flights_df['origin'] == 'EWR']\
    .merge(nycflights_weather_df[nycflights_weather_df['origin'] == 'EWR']\
    .groupby(['year','month','day'])[['temp', 'humid']]\
    .mean().reset_index()\
    .rename(columns = {'temp':'atemp','humid':'ahumid'}),\
    how='left', on=['year', 'month', 'day'])

    return result

Which I call from timeit method like this for various runtimes:

Query_Type_list = [Group By & Sort', 'Join', 'Join',\
                   'Join & Group By']

def compare_queries(Query_Type_list, queries, no_of_times):

    if no_of_times == 10:
        print('Inside:',no_of_times)
        for i, qtl in zip(range(3),Query_Type_list):
            task = 'Task' + str(i+1)
            index.append(task)
            query_type_ls.append(qtl)

            pure_pandas_time = timeit.timeit(lambda: pure_pandas(i), number=no_of_times)
            pandas_query_time.append(pure_pandas_time)
            # print(pure_pandas_time)

        timeit_df = pd.DataFrame(list(zip(index,Query_Type_list,pandas_query_time)),\
                                 columns=['Query No','Query Type','Pure Pandas Time'])
        timeit_df['RUN TIMES'] = '10T'
        timeit_df['Key'] = timeit_df['RUN TIMES'] + timeit_df['Query No']
        return timeit_df
        del timeit_df

    elif no_of_times == 50:
        print('Inside:',no_of_times)
        for i, qtl in zip(range(3),Query_Type_list):
            task = 'Task' + str(i+1)
            index.append(task)
            query_type_ls.append(qtl)

            pure_pandas_time = timeit.timeit(lambda: pure_pandas(i), number=no_of_times)
            pandas_query_time.append(pure_pandas_time)
            # print(pure_pandas_time)

        timeit_df = pd.DataFrame(list(zip(index,Query_Type_list,pandas_query_time)),\
                                 columns=['Query No','Query Type','Pure Pandas Time'])
        timeit_df['RUN TIMES'] = '50T'
        timeit_df['Key'] = timeit_df['RUN TIMES'] + timeit_df['Query No']
        return timeit_df
        del timeit_df
    else:
        print('Do Nothing:')

# The calls for running 10 and 50 times:
timeit_df_10 = compare_queries(Query_Type_list, 10)

timeit_df_50 = compare_queries(Query_Type_list, 50)

When I execute the above code, I am seeing the same results for 10 and 50 runs. If I segregate compare_queries (which is not the ideal way), then I see different results. Even the given code is not properly abstracted as I am checking for no_of_times parameter value in if condition of compare_queries function, I am unable to find the root cause. I dont want to repeat my code snippet for each run separately.

The whole point of doing it for different no_of_times is to check the performance of the same query.


来源: stackexchange

问:
Fail2Ban for Wordpress login attempts
I see the following messages in the logs of one of my wordpress sites:

```<code>[Fri Jan 13 07:56:02.161510 2023] [proxy_fcgi:error] [pid 333707:tid 139733525821184] [client 167.172.143.170:60594] AH01071: Got error 'PHP message: WordPress database error Column 'password' cannot be null for query INSERT INTO `wp_login_attempt_log` (`username`, `password`, `time`, `agent`, `ip`) VALUES ('seonest', NULL, '2023-01-13 07:56:02', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4240.193 Safari/537.36', '167.172.143.170') made by wp_xmlrpc_server->serve_request, IXR_Server->IXR_Server, IXR_Server->__construct, IXR_Server->serve, IXR_Server->call, IXR_Server->multiCall, IXR_Server->call, wp_xmlrpc_server->wp_getUsersBlogs, wp_xmlrpc_server->blogger_getUsersBlogs, wp_xmlrpc_server->login, wp_authenticate, do_action('wp_login_failed'), WP_Hook->do_action, WP_Hook->apply_filters, lal_actually_log'
</code>```

I would like to write a Fail2Ban filter that blocks the IP's accordingly.

Currently I am using this filter, which of course has no effect:

```<code>[INCLUDES]

before = common.conf

[definition]

_daemon = (?:wordpress|wp)

failregex = ^%(__prefix_line)sInstant blocking of connections from <HOST>$
            ^%(__prefix_line)sSpam comment \d+ from <HOST>$
            ^%(__prefix_line)sBlocked user enumeration attempt from <HOST>$
            ^%(__prefix_line)sBlocked authentication attempt for .* from <HOST>$
            ^%(__prefix_line)sBlocked username authentication attempt for .* from <HOST>$
            ^%(__prefix_line)sXML-RPC multicall authentication error from <HOST>$
            ^%(__prefix_line)sPingback error .* generated by <HOST>$
            ^%(__prefix_line)sAuthentication attempt for unknown user .* generated by <HOST>$
            ^%(__prefix_line)sREST authentication attempt for unknown user .* generated by <HOST>$
            ^%(__prefix_line)sXML-RPC authentication attempt for unknown user .* from <HOST>$
            ^%(__prefix_line)sXML-RPC request blocked from <HOST>$
            ^%(__prefix_line)s.*; Fake pingback from <HOST>$
            ^%(__prefix_line)sBlocked access from country '..' from <HOST>$

ignoreregex =
</code>```

Or is it not an attack but something else and I have a problem with wordpress?

ContentLicense: CC BY-SA 4.0

Title: Fail2Ban for Wordpress login attempts

Body:
I see the following messages in the logs of one of my wordpress sites:

[Fri Jan 13 07:56:02.161510 2023] [proxy_fcgi:error] [pid 333707:tid 139733525821184] [client 167.172.143.170:60594] AH01071: Got error 'PHP message: WordPress database error Column 'password' cannot be null for query INSERT INTO `wp_login_attempt_log` (`username`, `password`, `time`, `agent`, `ip`) VALUES ('seonest', NULL, '2023-01-13 07:56:02', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4240.193 Safari/537.36', '167.172.143.170') made by wp_xmlrpc_server->serve_request, IXR_Server->IXR_Server, IXR_Server->__construct, IXR_Server->serve, IXR_Server->call, IXR_Server->multiCall, IXR_Server->call, wp_xmlrpc_server->wp_getUsersBlogs, wp_xmlrpc_server->blogger_getUsersBlogs, wp_xmlrpc_server->login, wp_authenticate, do_action('wp_login_failed'), WP_Hook->do_action, WP_Hook->apply_filters, lal_actually_log'

I would like to write a Fail2Ban filter that blocks the IP's accordingly.

Currently I am using this filter, which of course has no effect:

[INCLUDES]

before = common.conf

[definition]

_daemon = (?:wordpress|wp)

failregex = ^%(__prefix_line)sInstant blocking of connections from <HOST>$
            ^%(__prefix_line)sSpam comment \d+ from <HOST>$
            ^%(__prefix_line)sBlocked user enumeration attempt from <HOST>$
            ^%(__prefix_line)sBlocked authentication attempt for .* from <HOST>$
            ^%(__prefix_line)sBlocked username authentication attempt for .* from <HOST>$
            ^%(__prefix_line)sXML-RPC multicall authentication error from <HOST>$
            ^%(__prefix_line)sPingback error .* generated by <HOST>$
            ^%(__prefix_line)sAuthentication attempt for unknown user .* generated by <HOST>$
            ^%(__prefix_line)sREST authentication attempt for unknown user .* generated by <HOST>$
            ^%(__prefix_line)sXML-RPC authentication attempt for unknown user .* from <HOST>$
            ^%(__prefix_line)sXML-RPC request blocked from <HOST>$
            ^%(__prefix_line)s.*; Fake pingback from <HOST>$
            ^%(__prefix_line)sBlocked access from country '..' from <HOST>$

ignoreregex =

Or is it not an attack but something else and I have a problem with wordpress?


问:
Hibernate - Entity referencing itself through a join table with an additional column
I have an annotated Entity called Part. It consists of an "id" and a few other variables. I have another table called "bomdefinitions". This table has three columns (qty, parent, target) (I understand target is a stupid name but I can't change it as the database already exists). The idea is a Part can be made up of many other parts, and can also be used in many other parts, and the table "bomdefinitions" says what parent has what "target"s associated with it and how many are used by it.

The problem is, if I comment out one of the OneToMany relationships in Part.java and leave the other, it works fine, but if I have them both in my code, trying to access either of them results in an infinite loop of Hibernate queries.

I can find examples of mapping an entity to itself, examples of mapping an entity using a join table with extra columns, and examples of various ways to do the annotations, but nothing doing all of that within a single application, and the individual examples I can find don't seem to be helping here.

Anyone with more experience in Hibernate have any ideas as to what I am doing wrong?

Edit (this code causes the infinite loop):

```<code>getHibernateTemplate().get(Part.class, id).getParentBomDefinitions();
</code>```

And here is the query in the Output -
It starts with:

```<code>Hibernate: select part0_.id as id0_3_, childbomde1_.target as target0_5_, childbomde1_.parent as parent5_, childbomde1_.target as target5_, childbomde1_.parent as parent4_0_, childbomde1_.target as target4_0_, childbomde1_.qty as qty4_0_, part2_.id as id0_1_ from parts part0_ left outer join bomdefinitions childbomde1_ on part0_.id=childbomde1_.target left outer join parts part2_ on childbomde1_.parent=part2_.id
Hibernate: select parentbomd0_.parent as parent0_2_, parentbomd0_.parent as parent2_, parentbomd0_.target as target2_, parentbomd0_.parent as parent4_1_, parentbomd0_.target as target4_1_, parentbomd0_.qty as qty4_1_, part1_.id as id0_0_ from bomdefinitions parentbomd0_ left outer join parts part1_ on parentbomd0_.target=part1_.id where parentbomd0_.parent=?
</code>```

Then these 2 queries repeat indefinitely:

```<code>Hibernate: select parentbomd0_.parent as parent0_2_, parentbomd0_.parent as parent2_, parentbomd0_.target as target2_, parentbomd0_.parent as parent4_1_, parentbomd0_.target as target4_1_, parentbomd0_.qty as qty4_1_, part1_.id as id0_0_ from bomdefinitions parentbomd0_ left outer join parts part1_ on parentbomd0_.target=part1_.id where parentbomd0_.parent=?
Hibernate: select childbomde0_.target as target0_2_, childbomde0_.parent as parent2_, childbomde0_.target as target2_, childbomde0_.parent as parent4_1_, childbomde0_.target as target4_1_, childbomde0_.qty as qty4_1_, part1_.id as id0_0_ from bomdefinitions childbomde0_ left outer join parts part1_ on childbomde0_.parent=part1_.id where childbomde0_.target=?
</code>```

BomDefinition.java (pretty much taken out of "Java Persistence with Hibernate")

```<code>@Entity
@Table(name = "bomdefinitions")
public class BomDefinition {

@Embeddable
public static class Id implements Serializable {

    @Column(name = "target")
    private String targetId;

    @Column(name = "parent")
    private String parentId;

    public Id() {}
    public Id(String targetId, String parentId) {
        this.targetId = targetId;
        this.parentId = parentId;
    }
    public boolean equals(Object o) {
        if (o != null && o instanceof Id) {
            Id that = (Id) o;
            return this.targetId.equals(that.targetId) && this.parentId.equals(that.parentId);
        } else {
            return false;
        }
    }
    public int hashCode() {
        return targetId.hashCode() + parentId.hashCode();
    }
}

@EmbeddedId
private Id id = new Id();

@Column(name = "qty")
private String quantity;

@ManyToOne
@JoinColumn(name = "parent",
            insertable = false,
            updatable = false)
private Part parent;

@ManyToOne
@JoinColumn(name = "target",
            insertable = false,
            updatable = false)
private Part child;

public BomDefinition() {}

public BomDefinition(String quantity, Part parent, Part child) {
    this.quantity = quantity;
    this.parent = parent;
    this.child = child;

    this.id.parentId = parent.getId();
    this.id.targetId = child.getId();
}

// Getters and Setters
}
</code>```

Part.java:

```<code>@Entity
@Table(name="parts", uniqueConstraints = {@UniqueConstraint(columnNames = {"id"})})
public class Part implements Serializable {

protected final Logger log = Logger.getLogger(getClass());

private String id;
// *** other variables ***

public Part() {}

public Part(String id, /* other variables */) {
    this.id = id;
    // *** other variables ***
}

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public String getId() {
    return this.id;
}
public void setId(String id) {
    this.id = id;
}

private Set parentBomDefinitions = new HashSet(0);
private Set childBomDefinitions = new HashSet(0);

@OneToMany(mappedBy = "parent",
            targetEntity = BomDefinition.class,
            cascade = {CascadeType.PERSIST, CascadeType.MERGE},
            fetch = FetchType.EAGER)
public Set getParentBomDefinitions() {
    return parentBomDefinitions;
}
public void setParentBomDefinitions(Set<BomDefinition> parentBomDefinitions) {
    this.parentBomDefinitions = parentBomDefinitions;
}

@OneToMany(mappedBy = "child",       // target?
            targetEntity = BomDefinition.class,
            cascade = {CascadeType.PERSIST, CascadeType.MERGE},
            fetch = FetchType.EAGER)
public Set getChildBomDefinitions() {
    return childBomDefinitions;
}
public void setChildBomDefinitions(Set childBomDefinitions) {
    this.childBomDefinitions = childBomDefinitions;
}

}
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I have an annotated Entity called Part. It consists of an "id" and a few other variables. I have another table called "bomdefinitions". This table has three columns (qty, parent, target) (I understand target is a stupid name but I can't change it as the database already exists). The idea is a Part can be made up of many other parts, and can also be used in many other parts, and the table "bomdefinitions" says what parent has what "target"s associated with it and how many are used by it.

The problem is, if I comment out one of the OneToMany relationships in Part.java and leave the other, it works fine, but if I have them both in my code, trying to access either of them results in an infinite loop of Hibernate queries.

I can find examples of mapping an entity to itself, examples of mapping an entity using a join table with extra columns, and examples of various ways to do the annotations, but nothing doing all of that within a single application, and the individual examples I can find don't seem to be helping here.

Anyone with more experience in Hibernate have any ideas as to what I am doing wrong?

Edit (this code causes the infinite loop):

getHibernateTemplate().get(Part.class, id).getParentBomDefinitions();

And here is the query in the Output -
It starts with:

Hibernate: select part0_.id as id0_3_, childbomde1_.target as target0_5_, childbomde1_.parent as parent5_, childbomde1_.target as target5_, childbomde1_.parent as parent4_0_, childbomde1_.target as target4_0_, childbomde1_.qty as qty4_0_, part2_.id as id0_1_ from parts part0_ left outer join bomdefinitions childbomde1_ on part0_.id=childbomde1_.target left outer join parts part2_ on childbomde1_.parent=part2_.id
Hibernate: select parentbomd0_.parent as parent0_2_, parentbomd0_.parent as parent2_, parentbomd0_.target as target2_, parentbomd0_.parent as parent4_1_, parentbomd0_.target as target4_1_, parentbomd0_.qty as qty4_1_, part1_.id as id0_0_ from bomdefinitions parentbomd0_ left outer join parts part1_ on parentbomd0_.target=part1_.id where parentbomd0_.parent=?

Then these 2 queries repeat indefinitely:

Hibernate: select parentbomd0_.parent as parent0_2_, parentbomd0_.parent as parent2_, parentbomd0_.target as target2_, parentbomd0_.parent as parent4_1_, parentbomd0_.target as target4_1_, parentbomd0_.qty as qty4_1_, part1_.id as id0_0_ from bomdefinitions parentbomd0_ left outer join parts part1_ on parentbomd0_.target=part1_.id where parentbomd0_.parent=?
Hibernate: select childbomde0_.target as target0_2_, childbomde0_.parent as parent2_, childbomde0_.target as target2_, childbomde0_.parent as parent4_1_, childbomde0_.target as target4_1_, childbomde0_.qty as qty4_1_, part1_.id as id0_0_ from bomdefinitions childbomde0_ left outer join parts part1_ on childbomde0_.parent=part1_.id where childbomde0_.target=?

BomDefinition.java (pretty much taken out of "Java Persistence with Hibernate")

@Entity
@Table(name = "bomdefinitions")
public class BomDefinition {

@Embeddable
public static class Id implements Serializable {

    @Column(name = "target")
    private String targetId;

    @Column(name = "parent")
    private String parentId;

    public Id() {}
    public Id(String targetId, String parentId) {
        this.targetId = targetId;
        this.parentId = parentId;
    }
    public boolean equals(Object o) {
        if (o != null && o instanceof Id) {
            Id that = (Id) o;
            return this.targetId.equals(that.targetId) && this.parentId.equals(that.parentId);
        } else {
            return false;
        }
    }
    public int hashCode() {
        return targetId.hashCode() + parentId.hashCode();
    }
}

@EmbeddedId
private Id id = new Id();

@Column(name = "qty")
private String quantity;

@ManyToOne
@JoinColumn(name = "parent",
            insertable = false,
            updatable = false)
private Part parent;

@ManyToOne
@JoinColumn(name = "target",
            insertable = false,
            updatable = false)
private Part child;

public BomDefinition() {}

public BomDefinition(String quantity, Part parent, Part child) {
    this.quantity = quantity;
    this.parent = parent;
    this.child = child;

    this.id.parentId = parent.getId();
    this.id.targetId = child.getId();
}

// Getters and Setters
}

Part.java:

@Entity
@Table(name="parts", uniqueConstraints = {@UniqueConstraint(columnNames = {"id"})})
public class Part implements Serializable {

protected final Logger log = Logger.getLogger(getClass());

private String id;
// *** other variables ***

public Part() {}

public Part(String id, /* other variables */) {
    this.id = id;
    // *** other variables ***
}

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public String getId() {
    return this.id;
}
public void setId(String id) {
    this.id = id;
}

private Set parentBomDefinitions = new HashSet(0);
private Set childBomDefinitions = new HashSet(0);

@OneToMany(mappedBy = "parent",
            targetEntity = BomDefinition.class,
            cascade = {CascadeType.PERSIST, CascadeType.MERGE},
            fetch = FetchType.EAGER)
public Set getParentBomDefinitions() {
    return parentBomDefinitions;
}
public void setParentBomDefinitions(Set<BomDefinition> parentBomDefinitions) {
    this.parentBomDefinitions = parentBomDefinitions;
}

@OneToMany(mappedBy = "child",       // target?
            targetEntity = BomDefinition.class,
            cascade = {CascadeType.PERSIST, CascadeType.MERGE},
            fetch = FetchType.EAGER)
public Set getChildBomDefinitions() {
    return childBomDefinitions;
}
public void setChildBomDefinitions(Set childBomDefinitions) {
    this.childBomDefinitions = childBomDefinitions;
}

}


问:
How to get InsertedID from UniQuery's UpdateSQLs statement
I am using Uniquery in delphi-rio.

UniQuery's SQL.Text is:

```<code>Select ID, Column1
From Table
</code>```

Here ID is an auto-incrementing ID.

The insert statement in UpdateSQLs is:

```<code>INSERT INTO table (Column1)
VALUES (:Column1)

SET :ID = SCOPE_IDENTITY()
</code>```

After ApplyUpdates();, the value of Uniquery.FieldByName('ID').AsInteger is returned as 0.

If you do Uniquery.ParamByName('ID').AsInteger, it says that there is no parameter.

How can I get the ID value?

I tried creating parameter with runtime or using DML refresh, but it doesn't work.

Body:
I am using Uniquery in delphi-rio.

UniQuery's SQL.Text is:

Select ID, Column1
From Table

Here ID is an auto-incrementing ID.

The insert statement in UpdateSQLs is:

INSERT INTO table (Column1)
VALUES (:Column1)

SET :ID = SCOPE_IDENTITY()

After ApplyUpdates();, the value of Uniquery.FieldByName('ID').AsInteger is returned as 0.

If you do Uniquery.ParamByName('ID').AsInteger, it says that there is no parameter.

How can I get the ID value?

I tried creating parameter with runtime or using DML refresh, but it doesn't work.


问:
getContentHeight in @monaco-editor/react does not look correct
I'm trying to use https://github.com/suren-atoyan/monaco-react. But I realize that its getContentHeight does not match the behavior described here.

Here is an example: https://stackblitz.com/edit/react-ts-en8wpm?file=EditorBasic.tsx,App.tsx,index.html. It starts with 500px, once we enter a newline, it becomes 518px, then another newline leads to 536px, etc. From what I understand, getContentHeight should not include the height of the editor.

```<code>import * as React from 'react';
import MonacoEditor from '@monaco-editor/react';

export default class EditorBasic extends React.Component<{}, {}> {
  editor: any;

  _handleEditorDidMount(editor, monaco) {
    this.editor = editor;
    this.editor.onDidContentSizeChange(this.handleResize.bind(this));
  }

  updateHeight = () => {
    console.log(
      'this.editor.getContentHeight()',
      this.editor.getContentHeight()
    );
  };

  handleResize() {
    if (this.editor && this.editor !== undefined) {
      this.updateHeight();
    }
  }

  render() {
    return (
      <MonacoEditor
        width="400px"
        height="500px"
        options={{ minimap: { enabled: false }, lineNumbers: 'off' }}
        defaultLanguage="javascript"
        defaultValue="content"
        onMount={this._handleEditorDidMount.bind(this)}
        theme="vs-dark"
      />
    );
  }
}
</code>```

Does anyone know if it's a bug of @monaco-editor/react? Is there any other API to get the real content height?

(* Link in GitHub: https://github.com/suren-atoyan/monaco-react/issues/442 *)

Body:
I'm trying to use https://github.com/suren-atoyan/monaco-react. But I realize that its getContentHeight does not match the behavior described here.

Here is an example: https://stackblitz.com/edit/react-ts-en8wpm?file=EditorBasic.tsx,App.tsx,index.html. It starts with 500px, once we enter a newline, it becomes 518px, then another newline leads to 536px, etc. From what I understand, getContentHeight should not include the height of the editor.

import * as React from 'react';
import MonacoEditor from '@monaco-editor/react';

export default class EditorBasic extends React.Component<{}, {}> {
  editor: any;

  _handleEditorDidMount(editor, monaco) {
    this.editor = editor;
    this.editor.onDidContentSizeChange(this.handleResize.bind(this));
  }

  updateHeight = () => {
    console.log(
      'this.editor.getContentHeight()',
      this.editor.getContentHeight()
    );
  };

  handleResize() {
    if (this.editor && this.editor !== undefined) {
      this.updateHeight();
    }
  }

  render() {
    return (
      <MonacoEditor
        width="400px"
        height="500px"
        options={{ minimap: { enabled: false }, lineNumbers: 'off' }}
        defaultLanguage="javascript"
        defaultValue="content"
        onMount={this._handleEditorDidMount.bind(this)}
        theme="vs-dark"
      />
    );
  }
}

Does anyone know if it's a bug of @monaco-editor/react? Is there any other API to get the real content height?

(* Link in GitHub: https://github.com/suren-atoyan/monaco-react/issues/442 *)


问:
How to use Footable in Blazor server
I want to use FooTable in blazor server project.
https://fooplugins.github.io/FooTable/

It is working when just showing.
but when input tag in row ,it can not work 2way binding.

How can I use this FooTable?
Or tell me other best solutions. if you know.

javascript

```<code>    function renderjQueryComponents() {
    jQuery(function ($) {$('.mk-table').footable();
    });
}
</code>```

*.razor

```<code>    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
        await isRuntime.InvokeVoidAsync("renderjQueryComponents");
        }
        await base.OnAfterRenderAsync(firstRender);
    }
</code>```

There is an input tag in the row, and even if I enter something, it will not be reflected in the binding value.

Title: How to use Footable in Blazor server

Body:
I want to use FooTable in blazor server project.
https://fooplugins.github.io/FooTable/

It is working when just showing.
but when input tag in row ,it can not work 2way binding.

How can I use this FooTable?
Or tell me other best solutions. if you know.

javascript

    function renderjQueryComponents() {
    jQuery(function ($) {$('.mk-table').footable();
    });
}

*.razor

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
        await isRuntime.InvokeVoidAsync("renderjQueryComponents");
        }
        await base.OnAfterRenderAsync(firstRender);
    }

There is an input tag in the row, and even if I enter something, it will not be reflected in the binding value.


问:
Repository always null after starting the application
I'm trying to develop an application in java where you can log in your credentials in frontend with JavaFX and it will log you in automatically with chrome web driver. For storage of password and email I use H2-Database with Spring Framework.

Unfortunately if I start the application the repository is always null. The Nullpointer Exception comes, when I try to access the repository. In other questions the reason has always been the dependeny injection. I tried all three Dependeny Injections (constructor level, setter level, field level). Here is my code:

MBA (website, where I want to login):

```<code>@Entity
@Getter
public class MBA {

    @Id
    private UUID id;
    private String email;
    private String password;

    public static WebDriver driver;
    private static int amountOfSales;

    public MBA() {
        this.id = UUID.randomUUID();
        this.email = null;
        this.password = null;
    }

    public MBA(String email, String password) {
        this.id = UUID.randomUUID();
        this.email = email;
        this.password = password;
    }

}
</code>```

MBAApplicationService:

```<code>@Service
public class MBAApplicationService {

    public static WebDriver driver;
    private static int amountOfSales;

    private MBARepository mbaRepository;

    @Autowired
    public MBAApplicationService(MBARepository mbaRepository) {
        this.mbaRepository = mbaRepository;
    }

    public void saveLogin(String email, String password) {
        MBA mba = new MBA(email, password);
        mbaRepository.save(mba);
    }

    public void chromeDriverSetUp() {
        System.setProperty("webdriver.chrome.driver", "C:\\Program Files (x86)\\chromedriver.exe");
        driver = new ChromeDriver();
        driver.manage().window().maximize();
    }

}
</code>```

MBARepository:

```<code>@Repository
public interface MBARepository extends CrudRepository\<MBA, UUID\> {

}
</code>```

Controller (Controller of JavaFXApplication):

```<code>@NoArgsConstructor
@AllArgsConstructor
@Service
public class Controller {

    //Integrationtest

    @FXML private Label mainSceneLabel;
    @FXML private Label loginsSceneLabel;
    @FXML private Label sellerSceneLabel;
    @FXML private TextField emailMBA;
    @FXML private PasswordField passwordMBA;
    @FXML private Label mbaAmountOfSales;
    private Stage stage;
    private Scene scene;
    private Parent root;

    @Autowired
    private MBARepository mbaRepository;

    @FXML
    public void openLoginScene() throws IOException {
        Parent root = FXMLLoader.load(getClass().getResource("LoginsScene.fxml"));
        stage = (Stage)(mainSceneLabel.getScene().getWindow());
        scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
    }

    @FXML
    public void openMainScene() throws IOException {
        Parent root = FXMLLoader.load(getClass().getResource("1_MainScene.fxml"));
        stage = (Stage)(loginsSceneLabel.getScene().getWindow());
        scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
    }

    @FXML
    public void switchToSellerViewScene() throws IOException {
        Parent root = FXMLLoader.load(getClass().getResource("SellerViewScene.fxml"));
        stage = (Stage)(mainSceneLabel.getScene().getWindow());
        scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
    }

    public void saveLogins() {
        //Amazon
        String emailAmazon = emailMBA.getText();
        String passwordAmazon = passwordMBA.getText();
        MBAApplicationService mbaApplicationService = new MBAApplicationService(mbaRepository);
        mbaApplicationService.saveLogin(emailAmazon, passwordAmazon);
    }

}
</code>```

Here is the error notification I get, when I want to save something in the repository:

```<code>Caused by: java.lang.NullPointerException: Cannot invoke "mba.MBARepository.save(Object)" because "this.mbaRepository" is null at com.example.moduleinfo/mba.MBAApplicationService.saveLogin(MBAA>pplicationService.java:58)
    at com.example.moduleinfo/com.example.moduleinfo.Controller.saveLogins(Controller.java:85)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    ... 53 more

</code>```

Here are my configurations:
Configurations

Body:
I'm trying to develop an application in java where you can log in your credentials in frontend with JavaFX and it will log you in automatically with chrome web driver. For storage of password and email I use H2-Database with Spring Framework.

Unfortunately if I start the application the repository is always null. The Nullpointer Exception comes, when I try to access the repository. In other questions the reason has always been the dependeny injection. I tried all three Dependeny Injections (constructor level, setter level, field level). Here is my code:

MBA (website, where I want to login):

@Entity
@Getter
public class MBA {

    @Id
    private UUID id;
    private String email;
    private String password;

    public static WebDriver driver;
    private static int amountOfSales;

    public MBA() {
        this.id = UUID.randomUUID();
        this.email = null;
        this.password = null;
    }

    public MBA(String email, String password) {
        this.id = UUID.randomUUID();
        this.email = email;
        this.password = password;
    }

}

MBAApplicationService:

@Service
public class MBAApplicationService {

    public static WebDriver driver;
    private static int amountOfSales;

    private MBARepository mbaRepository;

    @Autowired
    public MBAApplicationService(MBARepository mbaRepository) {
        this.mbaRepository = mbaRepository;
    }

    public void saveLogin(String email, String password) {
        MBA mba = new MBA(email, password);
        mbaRepository.save(mba);
    }

    public void chromeDriverSetUp() {
        System.setProperty("webdriver.chrome.driver", "C:\\Program Files (x86)\\chromedriver.exe");
        driver = new ChromeDriver();
        driver.manage().window().maximize();
    }

}

MBARepository:

@Repository
public interface MBARepository extends CrudRepository\<MBA, UUID\> {

}

Controller (Controller of JavaFXApplication):

@NoArgsConstructor
@AllArgsConstructor
@Service
public class Controller {

    //Integrationtest

    @FXML private Label mainSceneLabel;
    @FXML private Label loginsSceneLabel;
    @FXML private Label sellerSceneLabel;
    @FXML private TextField emailMBA;
    @FXML private PasswordField passwordMBA;
    @FXML private Label mbaAmountOfSales;
    private Stage stage;
    private Scene scene;
    private Parent root;

    @Autowired
    private MBARepository mbaRepository;

    @FXML
    public void openLoginScene() throws IOException {
        Parent root = FXMLLoader.load(getClass().getResource("LoginsScene.fxml"));
        stage = (Stage)(mainSceneLabel.getScene().getWindow());
        scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
    }

    @FXML
    public void openMainScene() throws IOException {
        Parent root = FXMLLoader.load(getClass().getResource("1_MainScene.fxml"));
        stage = (Stage)(loginsSceneLabel.getScene().getWindow());
        scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
    }

    @FXML
    public void switchToSellerViewScene() throws IOException {
        Parent root = FXMLLoader.load(getClass().getResource("SellerViewScene.fxml"));
        stage = (Stage)(mainSceneLabel.getScene().getWindow());
        scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
    }

    public void saveLogins() {
        //Amazon
        String emailAmazon = emailMBA.getText();
        String passwordAmazon = passwordMBA.getText();
        MBAApplicationService mbaApplicationService = new MBAApplicationService(mbaRepository);
        mbaApplicationService.saveLogin(emailAmazon, passwordAmazon);
    }

}

Here is the error notification I get, when I want to save something in the repository:

Caused by: java.lang.NullPointerException: Cannot invoke "mba.MBARepository.save(Object)" because "this.mbaRepository" is null at com.example.moduleinfo/mba.MBAApplicationService.saveLogin(MBAA>pplicationService.java:58)
    at com.example.moduleinfo/com.example.moduleinfo.Controller.saveLogins(Controller.java:85)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    ... 53 more

Here are my configurations:
Configurations


问:
Unable to send records back from Lambda to kinesis firehose delivery stream
I've attached a lambda function to my kinesis firehose delivery stream to transform the record as per my requirement. But the error i get is this:-

```<code>The Lambda function was successfully invoked but it returned an error result.
</code>```

Here is what it logs in the error/ prefix of my s3 bucket the json reads as follows:-

```<code>{
"attemptsMade":4,
"arrivalTimestamp":1673595303311,
"errorCode":"Lambda.FunctionError",
"errorMessage":"The Lambda function was successfully invoked but it returned an error result.",
"attemptEndingTimestamp":1673595379712,
"rawData":"eyJkZXZpY2VfbmFtZSI6ImluSGFuZC1SVFUiLCJUZW1wZXJhdHVyZSI6MjQsIlB5cmFub21ldGVyIjoxMiwiQWN0aXZlLVBvd2VyIjowLCJWb2x0YWdlLTEiOjI0MC4wNjk5OTk5OTk5OTk5OSwiQWN0aXZlLUltcG9ydCI6Mi41Njk5OTk5OTk5OTk5OTk4LCJ0aW1lIjoxNjczNTk1MzAzMjMxfQo="
}
</code>```

Here is my lambda code:-

```<code>
exports.handler = async (event, context) => {
    const output = event.records.map((rcord) => {
        const firehose_stream_data = Buffer.from(rcord.data,'base64').toString();
        const records = JSON.parse(firehose_stream_data);
        let {time} = records;
        let timestamp = new Date(new Date(time).toLocaleString('en-US', { timeZone: 'Asia/Kolkata' }));
        let date = timestamp.getDate();
        let month = timestamp.getMonth() + 1;
        month = ( month < 10 ? '0' + month : month);
        let year = timestamp.getFullYear();
        let hour = (timestamp.getHours() <= 9) ? '0' + timestamp.getHours() : timestamp.getHours();
        let minute = (timestamp.getMinutes() <= 9) ? '0' + timestamp.getMinutes() : timestamp.getMinutes();
        let second = (timestamp.getSeconds() <= 9) ? '0' + timestamp.getSeconds() : timestamp.getSeconds();
        let finalTimestamp = date + "-" + month + "-" + year+ " " +hour+":" +minute+":"+second;
        const finalRecord = JSON.stringify({
                ...records,
                time : finalTimestamp,
        });
        const partitionKeys = {site_name:records.device_name,year:year,month:month,day:date};

        return {
            recordId : rcord.recordId,
            result: 'Ok',
            data: (Buffer.from(JSON.stringify(finalRecord))).toString('base64'),
            metadata : {partitionKeys: partitionKeys}
        };

        /* This transformation is the "identity" transformation, the data is left intact */
        // recordId: record.recordId,
        // result: 'Ok',
        // data: record.data,

    });
    // console.log(`Processing completed.  Successful records ${output.length}.`);
    // return { records: output };
};

</code>```

The permission which lambda has are:-

```<code>Allow: kinesis:PutRecords & basic lambda execution role
</code>```

I basically convert the epoch in milliseconds to a proper timestamp, I also want to send the partition keys along with the payload to use partitionKeyFromLambda to parition data in IST time like:-

```<code>site_name=<name>/year=2023/month=01/day=13/<files>
</code>```

Any help will be greatly appreciated.

Body:
I've attached a lambda function to my kinesis firehose delivery stream to transform the record as per my requirement. But the error i get is this:-

The Lambda function was successfully invoked but it returned an error result.

Here is what it logs in the error/ prefix of my s3 bucket the json reads as follows:-

{
"attemptsMade":4,
"arrivalTimestamp":1673595303311,
"errorCode":"Lambda.FunctionError",
"errorMessage":"The Lambda function was successfully invoked but it returned an error result.",
"attemptEndingTimestamp":1673595379712,
"rawData":"eyJkZXZpY2VfbmFtZSI6ImluSGFuZC1SVFUiLCJUZW1wZXJhdHVyZSI6MjQsIlB5cmFub21ldGVyIjoxMiwiQWN0aXZlLVBvd2VyIjowLCJWb2x0YWdlLTEiOjI0MC4wNjk5OTk5OTk5OTk5OSwiQWN0aXZlLUltcG9ydCI6Mi41Njk5OTk5OTk5OTk5OTk4LCJ0aW1lIjoxNjczNTk1MzAzMjMxfQo="
}

Here is my lambda code:-

exports.handler = async (event, context) => {
    const output = event.records.map((rcord) => {
        const firehose_stream_data = Buffer.from(rcord.data,'base64').toString();
        const records = JSON.parse(firehose_stream_data);
        let {time} = records;
        let timestamp = new Date(new Date(time).toLocaleString('en-US', { timeZone: 'Asia/Kolkata' }));
        let date = timestamp.getDate();
        let month = timestamp.getMonth() + 1;
        month = ( month < 10 ? '0' + month : month);
        let year = timestamp.getFullYear();
        let hour = (timestamp.getHours() <= 9) ? '0' + timestamp.getHours() : timestamp.getHours();
        let minute = (timestamp.getMinutes() <= 9) ? '0' + timestamp.getMinutes() : timestamp.getMinutes();
        let second = (timestamp.getSeconds() <= 9) ? '0' + timestamp.getSeconds() : timestamp.getSeconds();
        let finalTimestamp = date + "-" + month + "-" + year+ " " +hour+":" +minute+":"+second;
        const finalRecord = JSON.stringify({
                ...records,
                time : finalTimestamp,
        });
        const partitionKeys = {site_name:records.device_name,year:year,month:month,day:date};

        return {
            recordId : rcord.recordId,
            result: 'Ok',
            data: (Buffer.from(JSON.stringify(finalRecord))).toString('base64'),
            metadata : {partitionKeys: partitionKeys}
        };

        /* This transformation is the "identity" transformation, the data is left intact */
        // recordId: record.recordId,
        // result: 'Ok',
        // data: record.data,

    });
    // console.log(`Processing completed.  Successful records ${output.length}.`);
    // return { records: output };
};

The permission which lambda has are:-

Allow: kinesis:PutRecords & basic lambda execution role

I basically convert the epoch in milliseconds to a proper timestamp, I also want to send the partition keys along with the payload to use partitionKeyFromLambda to parition data in IST time like:-

site_name=<name>/year=2023/month=01/day=13/<files>

Any help will be greatly appreciated.


问:
Can I use list comprehension for this code?
I want to express 'result' in this code using list comprehension just for fun.

Do you think i can do this? or it's impossible?

```<code>import random
result = []
for i in range(6):
    num = random.randint(1, 45)
    if num not in result:
        result.append(num)
print(result)
</code>```

I tried several times to make it, and reached this state.

```<code>result = [num if num not in result for i in range(6)]
</code>```

Body:
I want to express 'result' in this code using list comprehension just for fun.

Do you think i can do this? or it's impossible?

import random
result = []
for i in range(6):
    num = random.randint(1, 45)
    if num not in result:
        result.append(num)
print(result)

I tried several times to make it, and reached this state.

result = [num if num not in result for i in range(6)]


问:
reactjs - linking to div on same page?
I have looked through some of the answers on stackoverflow and tried to resolve but still getting a:

Cannot resolve anchor #how-it-works

```<code><div className='container'>

    <section className="header-banner">
         <Link href="#how-it-works">
                <a className="btn-dca-form">How it works?</a>
         </Link>
    </section>
    <section id="how-it-works"> //I tried to use a section and tried using the div as well.
       <div className="row">
         <div className="col-12 col-sm order-5" style={{paddingTop: "55px"}}>
              <Fragment>
                   <Mock_Form/>
              </Fragment>
          </div>
       </div>
    </section>
</div>
</code>```

I tried using standard html linking using #how-it-works and setting id of the div. That did not work either.

Title: reactjs - linking to div on same page?

Body:
I have looked through some of the answers on stackoverflow and tried to resolve but still getting a:

Cannot resolve anchor #how-it-works

         <Link href="#how-it-works">
                How it works?
         </Link>

 //I tried to use a section and tried using the div as well.

              <Fragment>
                   <Mock_Form/>
              </Fragment>

I tried using standard html linking using #how-it-works and setting id of the div. That did not work either.


问:
How to automate encoded data in Rest Assured
I am having a query that if we have to pass encoded data into json body, how our script will decode and run the test for us. Is it possible to pass encoded data in an automation framework?
Also in cucumber framework, suppose if there are 200 APIs and we have to pass different json body to each request, how can we achieve that? I mean making pojos for each request will make our code hard to maintain. How can we achieve this?

I tried to automate only four api's using pojo classes. But what if we have so many apis to automate. Can anyone please share framework for this.


问:
future created by async block is not `Send` with tokio::sync::Mutex
I do a server update in rust. it create patches between 2 binaries files, and serves static files

I try to do

```<code>let mut update_state;
if let Some(state) = update_stream.next().await {
    if let Ok(state) = state {
        update_state = state
    } else if let Err(err) = state {
        reply = BuildOutput { error: "Update failed: ".to_string() + &err.to_string() }
    }
} else {
    reply = BuildOutput { error: "Unreacheable".to_string() }
}

let state = update_state.borrow();
let progress = state.histogram.progress();

let res = update_stream.try_for_each(|_state| future::ready(Ok(()))).await;
</code>```

but get

```<code>let state = update_state.lock();
    |             ----- has type `tokio::sync::MutexGuard<'_, UpdateProgress>` which is not `Send`
...
273 |         let res = update_stream.try_for_each(|_state| future::ready(Ok(()))).await;
    |                                                                             ^^^^^^ await occurs here, with `state` maybe used later
...
305 |     }
    |     - `state` is later dropped here
</code>```

update_state is

```<code>#[derive(Clone)]
pub struct SharedUpdateProgress {
    state: Arc<Mutex<UpdateProgress>>,
}

impl SharedUpdateProgress {
    pub fn new(target_revision: CleanName) -> Self {
        Self { state: Arc::new(Mutex::new(UpdateProgress::new(target_revision))) }
    }

    pub fn lock(&self) -> MutexGuard<'_, UpdateProgress> {
        self.state.lock().unwrap()
    }
}
</code>```

type and Mutex/MutexGuard are from tokio::sync

UpdateProgress :

```<code>#[derive(Debug)]
pub struct UpdateProgress {
    /// Current update target revision
    pub target_revision: CleanName,

    /// Current update stage
    pub stage: UpdateStage,

    /// Number of files to download
    pub download_files: usize,
    /// Number of bytes to download
    pub download_bytes: u64,

    /// Number of files to install
    pub apply_files: usize,
    /// Number of bytes to apply
    pub apply_input_bytes: u64,
    /// Number of bytes to install
    pub apply_output_bytes: u64,

    /// Current package beeing applied
    pub downloading_package_idx: usize,
    /// Current operation beeing downloaded
    pub downloading_operation_idx: usize,

    /// Current package beeing applied
    pub applying_package_idx: usize,
    /// Current operation beeing applied
    pub applying_operation_idx: usize,

    /// Global update progression histogram
    pub histogram: Histogram<Progression>,

    /// Per step update progression
    pub steps: Vec<UpdateStepState>,
}
</code>```

Before, I used RefCell but switch to std::sync::Arc and tokio::sync::Mutex to add Send trait but didn't fix my issue.
So how to add Send trait or fix my issue ?
Thanks

Body:
I do a server update in rust. it create patches between 2 binaries files, and serves static files

I try to do

let mut update_state;
if let Some(state) = update_stream.next().await {
    if let Ok(state) = state {
        update_state = state
    } else if let Err(err) = state {
        reply = BuildOutput { error: "Update failed: ".to_string() + &err.to_string() }
    }
} else {
    reply = BuildOutput { error: "Unreacheable".to_string() }
}

let state = update_state.borrow();
let progress = state.histogram.progress();

let res = update_stream.try_for_each(|_state| future::ready(Ok(()))).await;

but get

let state = update_state.lock();
    |             ----- has type `tokio::sync::MutexGuard<'_, UpdateProgress>` which is not `Send`
...
273 |         let res = update_stream.try_for_each(|_state| future::ready(Ok(()))).await;
    |                                                                             ^^^^^^ await occurs here, with `state` maybe used later
...
305 |     }
    |     - `state` is later dropped here

update_state is

#[derive(Clone)]
pub struct SharedUpdateProgress {
    state: Arc<Mutex<UpdateProgress>>,
}

impl SharedUpdateProgress {
    pub fn new(target_revision: CleanName) -> Self {
        Self { state: Arc::new(Mutex::new(UpdateProgress::new(target_revision))) }
    }

    pub fn lock(&self) -> MutexGuard<'_, UpdateProgress> {
        self.state.lock().unwrap()
    }
}

type and Mutex/MutexGuard are from tokio::sync

UpdateProgress :

#[derive(Debug)]
pub struct UpdateProgress {
    /// Current update target revision
    pub target_revision: CleanName,

    /// Current update stage
    pub stage: UpdateStage,

    /// Number of files to download
    pub download_files: usize,
    /// Number of bytes to download
    pub download_bytes: u64,

    /// Number of files to install
    pub apply_files: usize,
    /// Number of bytes to apply
    pub apply_input_bytes: u64,
    /// Number of bytes to install
    pub apply_output_bytes: u64,

    /// Current package beeing applied
    pub downloading_package_idx: usize,
    /// Current operation beeing downloaded
    pub downloading_operation_idx: usize,

    /// Current package beeing applied
    pub applying_package_idx: usize,
    /// Current operation beeing applied
    pub applying_operation_idx: usize,

    /// Global update progression histogram
    pub histogram: Histogram<Progression>,

    /// Per step update progression
    pub steps: Vec<UpdateStepState>,
}

Before, I used RefCell but switch to std::sync::Arc and tokio::sync::Mutex to add Send trait but didn't fix my issue.
So how to add Send trait or fix my issue ?
Thanks


问:
Which lines in one DataFrame do not occur in another?
I have got two similar csv files. With similar I mean that both have the same headers and most of the lines are identical. I read them in using pd.read_csv into df1 and df2.  Now I want the software to tell me which lines in df1 do not occur in df2. Note that by using pd.read_csv each line in df1 obtained an auto generated index which might differ from the index in df2 even if it is the same line. Hence, comparing the indicies would lead to the wrong result.


问:
Can thread join twice in java?
I am new to java.
When I review the codebase of my company, I see it do the thread join twice.
Something like this:

```<code>if (timeout) {
    try {
        this.join();
        this.join();
    } catch(exception e) {}
 }
</code>```

As I learned c/c++, thread will become unjoinable after joined.
Does anyone know what's the purpose of this ?

Thanks for help!!

I tried ask somebody in my team, but they do not know for sure.

Title: Can thread join twice in java?

Body:
I am new to java.
When I review the codebase of my company, I see it do the thread join twice.
Something like this:

if (timeout) {
    try {
        this.join();
        this.join();
    } catch(exception e) {}
 }

As I learned c/c++, thread will become unjoinable after joined.
Does anyone know what's the purpose of this ?

Thanks for help!!

I tried ask somebody in my team, but they do not know for sure.


问:
Payment Gateway Abstraction
I am currently having a problem, I have a payment gateway and its API Keys, But multiple departments in my company need seperate access to the Payment Gateway. According to our policy I cannot share the API keys of the payment gateway directly to other departments. How do i abstract the payment gateway and provide them with credentials created by me. For example, Some people have common auth portal like auth.company.com where all the login, register request of a company end up. So is there a way to create a portal payment.company.com and provide other departments of my company to access the portal and get the payment response back in their deparment website instantly. Is it possible? can anyone suggest me an architecture of how to that system will work?

I was planning to build a website where it takes several arguments such as source which means from where the request is coming so that i can authenticate if it is a valid source, destination the location where the payment application should redirect once payment is completed successfully, destination_failed the location where the payment application should redirect once the payment is not successful.

Title: Payment Gateway Abstraction


问:
tar.gz decompression with .ts results in different files in the browser?
I want a Typescript (or JS) gz extractor identical to command line. the issue is the decompressed file does not match the original. On the MacOS command line, it matches, but in javascript, even the size doesn't match.

I currently am using tar -xzvf on command line, for which the files decompress correctly to their original sizes in the terminal. Specifically, I use tar_file.add(source_file_path, arcname=os.path.basename(source_file_path)) in Python to compress the file before I upload to s3.

In Javascript, I've tried a ton of different solutions. tar-stream and tar packages both result in files that are a bit too large (i.e. all files with original size under 10240 bytes become 10240 bytes). Pako is close but also doesn't do small files, and is like 50% off on one of the bigger files. Here is an example file on s3 that unzips differently in terminal and in JS.

Here is what works when I don't have a .tar.gz file; the binary file is totally fine:

const store = async function (filename: string) {
  const link = "https://zkemail-zkey-chunks.s3.amazonaws.com/email.zkeyd";
  const resp = await fetch(link, {
    method: "GET",
  });
  const zkeyBuff = await resp.arrayBuffer();
  await localforage.setItem(filename, zkeyBuff);
}
```
<p>Here is some example bad code when I do have a .tar.gz file:</p>
<pre class="lang-js prettyprint-override"><code>// Un-targz the arrayBuffer into the filename without the .tar.gz on the end
const uncompressAndStore = async function (filename: string) {
  const link = "https://zkemail-zkey-chunks.s3.amazonaws.com/email.zkeyd.tar.gz";
  const resp = await fetch(link, {
    method: "GET",
  });
  const zkeyBuff = await resp.arrayBuffer();

  console.log(`Started to uncompress ${filename}...!`);
  const extract = tar.extract() // create a tar extract stream
  const gunzip = zlib.createGunzip(zkeyBuff) // create a gunzip stream from the array buffer
  gunzip.pipe(extract) // pipe the gunzip stream into the tar extract stream

  // header is the tar header, stream is the content body (might be an empty stream), call next when you are done with this entry
  extract.on('entry', function(header: any, stream: any, next: Function) {
    // decompress the entry data
    const extractedData: any = []
    stream.on('data', function(chunk: any) {
      extractedData.push(chunk)
    })

    // make sure to call next when the entry is fully processed
    stream.on('end', function() {
      next()

      console.assert(filename.endsWith(zkeyExtension), `Filename doesn't end in ${zkeyExtension}`)
      const rawFilename = filename.replace(/.tar.gz$/, "");
      // save the extracted data to localForage
      localforage.setItem(rawFilename, extractedData, function(err: Error) {
        if (err) {
          console.error(`Couldn't extract data from ${filename}:` + err.message)
        } else {
          console.log('Saved extracted file to localForage')
        }
      })
    })
  })

  // all entries have been processed
  extract.on('finish', function() {
    console.log(`Finished extracting ${filename}`)
  })
}
</code>```

And here is the code where I zip it up and upload it in Python:

import boto3
import os
import tarfile

s3 = boto3.client('s3')  # Ask Aayush for the access key and secret access key

def upload_to_s3(filename, dir=""):
    with open(dir + filename, 'rb') as file:
        print("Starting upload...")
        s3.upload_fileobj(file, bucket_name, filename, ExtraArgs={
                          'ACL': 'public-read', 'ContentType': 'binary/octet-stream'})
        print("Done uploading!")

file = "..."
# Create a zip file for the file
tar_file_name = file + '.tar.gz'
with tarfile.open(tar_file_name, 'w:gz') as tar_file:
    source_file_path = dir + file
    print("Compressing: ", source_file_path)
    tar_file.add(source_file_path, arcname=os.path.basename(source_file_path))

# Upload the zip file to the AWS bucket, overwriting any existing file with the same name
upload_to_s3(tar_file_name)
```

Body:
I want a Typescript (or JS) gz extractor identical to command line. the issue is the decompressed file does not match the original. On the MacOS command line, it matches, but in javascript, even the size doesn't match.

I currently am using tar -xzvf on command line, for which the files decompress correctly to their original sizes in the terminal. Specifically, I use tar_file.add(source_file_path, arcname=os.path.basename(source_file_path)) in Python to compress the file before I upload to s3.

In Javascript, I've tried a ton of different solutions. tar-stream and tar packages both result in files that are a bit too large (i.e. all files with original size under 10240 bytes become 10240 bytes). Pako is close but also doesn't do small files, and is like 50% off on one of the bigger files. Here is an example file on s3 that unzips differently in terminal and in JS.

Here is what works when I don't have a .tar.gz file; the binary file is totally fine:

const store = async function (filename: string) {
  const link = "https://zkemail-zkey-chunks.s3.amazonaws.com/email.zkeyd";
  const resp = await fetch(link, {
    method: "GET",
  });
  const zkeyBuff = await resp.arrayBuffer();
  await localforage.setItem(filename, zkeyBuff);
}

Here is some example bad code when I do have a .tar.gz file:

// Un-targz the arrayBuffer into the filename without the .tar.gz on the end
const uncompressAndStore = async function (filename: string) {
  const link = "https://zkemail-zkey-chunks.s3.amazonaws.com/email.zkeyd.tar.gz";
  const resp = await fetch(link, {
    method: "GET",
  });
  const zkeyBuff = await resp.arrayBuffer();

  console.log(`Started to uncompress ${filename}...!`);
  const extract = tar.extract() // create a tar extract stream
  const gunzip = zlib.createGunzip(zkeyBuff) // create a gunzip stream from the array buffer
  gunzip.pipe(extract) // pipe the gunzip stream into the tar extract stream

  // header is the tar header, stream is the content body (might be an empty stream), call next when you are done with this entry
  extract.on('entry', function(header: any, stream: any, next: Function) {
    // decompress the entry data
    const extractedData: any = []
    stream.on('data', function(chunk: any) {
      extractedData.push(chunk)
    })

    // make sure to call next when the entry is fully processed
    stream.on('end', function() {
      next()

      console.assert(filename.endsWith(zkeyExtension), `Filename doesn't end in ${zkeyExtension}`)
      const rawFilename = filename.replace(/.tar.gz$/, "");
      // save the extracted data to localForage
      localforage.setItem(rawFilename, extractedData, function(err: Error) {
        if (err) {
          console.error(`Couldn't extract data from ${filename}:` + err.message)
        } else {
          console.log('Saved extracted file to localForage')
        }
      })
    })
  })

  // all entries have been processed
  extract.on('finish', function() {
    console.log(`Finished extracting ${filename}`)
  })
}

And here is the code where I zip it up and upload it in Python:

import boto3
import os
import tarfile

s3 = boto3.client('s3')  # Ask Aayush for the access key and secret access key

def upload_to_s3(filename, dir=""):
    with open(dir + filename, 'rb') as file:
        print("Starting upload...")
        s3.upload_fileobj(file, bucket_name, filename, ExtraArgs={
                          'ACL': 'public-read', 'ContentType': 'binary/octet-stream'})
        print("Done uploading!")

file = "..."
# Create a zip file for the file
tar_file_name = file + '.tar.gz'
with tarfile.open(tar_file_name, 'w:gz') as tar_file:
    source_file_path = dir + file
    print("Compressing: ", source_file_path)
    tar_file.add(source_file_path, arcname=os.path.basename(source_file_path))

# Upload the zip file to the AWS bucket, overwriting any existing file with the same name
upload_to_s3(tar_file_name)


问:
How can I set proper compiler for Cmake using ninja?
I want to set jenkins build my cmake project.

I set 'ninja' as make program.
and following error occurs

```<code>-- Running vcpkg install - done
-- The C compiler identification is MSVC 19.34.31937.0
-- The CXX compiler identification is MSVC 19.34.31937.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/ProgramData/Jenkins/.jenkins/tools/hudson.plugins.cmake.CmakeTool/3.25.1/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
  The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/ProgramData/Jenkins/.jenkins/workspace/JenkinsTest/build/CMakeFiles/CMakeScratch/TryCompile-tkcxl7
</code>```

I saw some advice using vcvarsall.bat file but I failed to resolve. Maybe I misunderstand usage of it.

When I set Visual Studio as generater instead of ninja, jenkins works perfectly.
If you need more information to answer, please tell me. I am not sure what is needed to determine.

Body:
I want to set jenkins build my cmake project.

I set 'ninja' as make program.
and following error occurs

-- Running vcpkg install - done
-- The C compiler identification is MSVC 19.34.31937.0
-- The CXX compiler identification is MSVC 19.34.31937.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/ProgramData/Jenkins/.jenkins/tools/hudson.plugins.cmake.CmakeTool/3.25.1/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
  The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/ProgramData/Jenkins/.jenkins/workspace/JenkinsTest/build/CMakeFiles/CMakeScratch/TryCompile-tkcxl7

I saw some advice using vcvarsall.bat file but I failed to resolve. Maybe I misunderstand usage of it.

When I set Visual Studio as generater instead of ninja, jenkins works perfectly.
If you need more information to answer, please tell me. I am not sure what is needed to determine.


问:
Lua substring with word part (protection/skip)
Need help with function, which will used like string.sub, but will save color part of string</p>
```<code>-- namespaces:
local stringf;

-- @class stringf
-- @desc string helper functions
stringf = {}; do
    -- @private
    local str = "\affffffffSample \aff8080ffText";

    -- @public

    -- @param {string} s Some Text
    -- @param {number} f How much to extract the string, float value from [0.0 - 1.0]
    -- @desc Extracting piece of text with saving hex colors
    function stringf:sub_hex(s, f)
        -- ...
    end

    -- @region Testing
    print(stringf:sub_hex(str, .5)); -- \affffffffSample
    print(stringf:sub_hex(str, .9)); -- \affffffffSample \aff8080ffTe
end
</code>```

Body:
Need help with function, which will used like string.sub, but will save color part of string

-- namespaces:
local stringf;

-- @class stringf
-- @desc string helper functions
stringf = {}; do
    -- @private
    local str = "\affffffffSample \aff8080ffText";

    -- @public

    -- @param {string} s Some Text
    -- @param {number} f How much to extract the string, float value from [0.0 - 1.0]
    -- @desc Extracting piece of text with saving hex colors
    function stringf:sub_hex(s, f)
        -- ...
    end

    -- @region Testing
    print(stringf:sub_hex(str, .5)); -- \affffffffSample
    print(stringf:sub_hex(str, .9)); -- \affffffffSample \aff8080ffTe
end


问:
how to fetch data from table if data in inserted in object form in laravel 8
```<code> @foreach ($all_products as $product)

                    @foreach(json_decode($product->attributes) as $attributes)

                         @if($attributes[1]->name==$color)

                                 <x-frontend.product.product-card :product="$product" />

                                 @endif

                    @endforeach
                    @endforeach
</code>```

data fetch only this {"1":[{"type":"color","name":"blue"}]}

and i have to find {"2":[{"type":"size","name":"m"}]

Body:
 @foreach ($all_products as $product)

                    @foreach(json_decode($product->attributes) as $attributes)

                         @if($attributes[1]->name==$color)

                                 <x-frontend.product.product-card :product="$product" />

                                 @endif

                    @endforeach
                    @endforeach

data fetch only this {"1":[{"type":"color","name":"blue"}]}

and i have to find {"2":[{"type":"size","name":"m"}]


问:
The div was empty when add headers on iframe to showing NextJS page
I want to add headers on iframe src like this example.

Here is my code:

```<code> <iframe></iframe>
  <script>
    async function getSrc() {
      const res = await fetch("https://mynextjsapp.com/login", {
        method: 'GET',
        headers: {
          "Authorization": "token",
        }
      });
      const blob = await res.blob();
      const urlObject = URL.createObjectURL(blob);
      document.querySelector('iframe').setAttribute("src", urlObject)
    }
    getSrc();
</script>
</code>```

Unfortunately, it blank and showing nothing. Then when I trace that, it because the content inside div with id __next is empty when I fetch that NextJS page:

The content inside div with id __next should it look like this:

when I use iframe like this  there is no issue, the div is not empty:

Is anyone can explain?or have a solution for this?
Thanks.

Body:
I want to add headers on iframe src like this example.

Here is my code:

Unfortunately, it blank and showing nothing. Then when I trace that, it because the content inside div with id __next is empty when I fetch that NextJS page:

The content inside div with id __next should it look like this:

when I use iframe like this  there is no issue, the div is not empty:

Is anyone can explain?or have a solution for this?
Thanks.


问:
How do decode base64 video and play the video using flutter?
am recording the video using camera plugin and saved the video in internal storage path then i have encoded video using base64.Now i need to decode the encoded value and play the decoded value in flutter application.If any one can help me. thanks in advance.</p>
```<code>_fileConvert(String path) {
    File file = File(path);
    List<int> fileInByte = file.readAsBytesSync();
    String fileInBase64 = base64Encode(fileInByte);
    print("fileInBase64............");
    print(fileInBase64);

  }
</code>```

Body:
am recording the video using camera plugin and saved the video in internal storage path then i have encoded video using base64.Now i need to decode the encoded value and play the decoded value in flutter application.If any one can help me. thanks in advance.

_fileConvert(String path) {
    File file = File(path);
    List<int> fileInByte = file.readAsBytesSync();
    String fileInBase64 = base64Encode(fileInByte);
    print("fileInBase64............");
    print(fileInBase64);

  }


问:
How can I detect which Android native function that is hooked by Cydia Substrate: MSHookFunction?
I want to detect hook behavior of MSHookFunction on Android but no idea yet. This is Cydia Substrate I use in my test app https://github.com/Breathleas/Android-Hooking-Template-Cydia-Substrate/tree/master/jni/Substrate

After complete function hook. I tried comparing the .text section between the in-memory module and the shared object lib file but couldn't find the trampoline function. Here is the Frida script on the codeshare that I referenced https://codeshare.frida.re/@lichao890427/find-android-hook/. The origin function is hooked but .text section data in memory is same with shared object lib file.


问:
How to implement timeline kind of UI in flutter?
How can we implement UI like the image attached below. I do not know if we can call this timeline UI or not. I found package in pub.dev but could we somehow paint this in flutter?


问:
React-draft-wysiwyg contents not editable
I'm new here. I'm currently building an editor using React-draft-wysiwyg editor. I was able to send my data to the backend and call it back. However, when I bring it back onto the Editor, I can't make any changes or edit the data. Below is my code :

```<code>let html = sendDescription.toString();
    let contentBlock = htmlToDraft(html);
    let contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks);
    let editorState1 = EditorState.createWithContent(contentState)
    let editorState = EditorState.moveFocusToEnd(editorState1);

  let [description, setDescription] = useState(editorState);
  const onEditorStateChange = (editorState) => {
    setDescription(editorState);
  }
</code>```

Note: Above,the "sendDescription" is my html data that I called from the backend

```<code><Editor             editorState={editorState}
                    onEditorStateChange={onEditorStateChange}
                    toolbarClassName="toolbarClassName"
                    wrapperClassName="wrapperClassName"
                    editorClassName="editorClassName"
                    onContentStateChange={onContentStateChangeJSon}

                  />
</code>```

Note: Above is My Editor

Can someone help me ?

I did Method 1:

```<code><Editor> editorState={editorState} </ Editor >
</code>```

Instead of Method 2.:

```<code><Editor> editorState={description} </ Editor >
</code>```

Because only method 1 was able to make the data displayed in the editor. When I did method 2, it was only showing an empty editor. If I needed to show more codes pls tell I'm really stuck.

Body:
I'm new here. I'm currently building an editor using React-draft-wysiwyg editor. I was able to send my data to the backend and call it back. However, when I bring it back onto the Editor, I can't make any changes or edit the data. Below is my code :

let html = sendDescription.toString();
    let contentBlock = htmlToDraft(html);
    let contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks);
    let editorState1 = EditorState.createWithContent(contentState)
    let editorState = EditorState.moveFocusToEnd(editorState1);

  let [description, setDescription] = useState(editorState);
  const onEditorStateChange = (editorState) => {
    setDescription(editorState);
  }

Note: Above,the "sendDescription" is my html data that I called from the backend

<Editor             editorState={editorState}
                    onEditorStateChange={onEditorStateChange}
                    toolbarClassName="toolbarClassName"
                    wrapperClassName="wrapperClassName"
                    editorClassName="editorClassName"
                    onContentStateChange={onContentStateChangeJSon}

                  />

Note: Above is My Editor

Can someone help me ?

I did Method 1:

<Editor> editorState={editorState} </ Editor >

Instead of Method 2.:

<Editor> editorState={description} </ Editor >

Because only method 1 was able to make the data displayed in the editor. When I did method 2, it was only showing an empty editor. If I needed to show more codes pls tell I'm really stuck.


问:
trying to compile static libmysqlcppconn8-static.a on Ubuntu 18.04.6 LTS
After looking ant trying all links on the web i just can't figure what is wrong.
g++ version :

```<code>g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
</code>```

This is my compilation line :

```<code>/usr/bin/g++ -fdiagnostics-color=always -Wall -std=c++11 -DSTATIC_CONCPP -I/home/vagrant/cpp/mysql-connector-cpp/include/ -I/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/ -I/home/vagrant/cpp/mysql-connector-cpp/common/ -I/home/vagrant/cpp/boost/ -I/home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf -g /home/vagrant/cpp/mysql_conn_app/main.cpp /home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread -lresolv -o /home/vagrant/cpp/mysql_conn_app/main.exe
</code>```

This is the error:

```<code>/tmp/ccUnnhKN.o: In function `mysqlx::abi2::r0::string::traits<char>::from_str(mysqlx::abi2::r0::string&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/devapi/common.h:220: undefined reference to `mysqlx::abi2::r0::string::Impl::from_utf8(mysqlx::abi2::r0::string&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccUnnhKN.o: In function `mysqlx::abi2::r0::string::traits<char>::to_str[abi:cxx11](mysqlx::abi2::r0::string const&)':
/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/devapi/common.h:225: undefined reference to `mysqlx::abi2::r0::string::Impl::to_utf8[abi:cxx11](mysqlx::abi2::r0::string const&)'
/tmp/ccUnnhKN.o: In function `mysqlx::abi2::r0::SessionSettings::SessionSettings(mysqlx::abi2::r0::string const&)':
/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/devapi/settings.h:526: undefined reference to `mysqlx::abi2::r0::common::Settings_impl::set_from_uri(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::log_handler_init()':
./build/cdk/protocol/mysqlx/./cdk/protocol/mysqlx/protocol.cc:131: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Ok(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:947: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Error(unsigned short, cdk::foundation::string
....

what is wrong here ?
</code>```

also when adding "-D_GLIBCXX_USE_CXX11_ABI=0" as suggested here:
still not working

```<code>/usr/bin/g++ -fdiagnostics-color=always -Wall -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -DSTATIC_CONCPP -I/home/vagrant/cpp/mysql-connector-cpp/include/ -I/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/ -I/home/vagrant/cpp/mysql-connector-cpp/common/ -I/home/vagrant/cpp/boost/ -I/home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf -g /home/vagrant/cpp/mysql_conn_app/main.cpp /home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread -lresolv -o /home/vagrant/cpp/mysql_conn_app/main.exe
</code>```

gives :

```<code>/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::log_handler_init()':
./build/cdk/protocol/mysqlx/./cdk/protocol/mysqlx/protocol.cc:131: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Ok(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:947: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Error(unsigned short, cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:1146: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Expr_builder_base::set_call(cdk::protocol::mysqlx::api::Db_obj const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2562: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
</code>```

adding protobuf + -D_GLIBCXX_USE_CXX11_ABI=0  same error:

```<code> /usr/bin/g++ -fdiagnostics-color=always -Wall -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -DSTATIC_CONCPP -I/home/vagrant/cpp/mysql-connector-cpp/include/ -I/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/ -I/home/vagrant/cpp/mysql-connector-cpp/common/ -I/home/vagrant/cpp/boost/ -I/home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf -g /home/vagrant/cpp/mysql_conn_app/main.cpp /home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a /home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf/protobuf-3.19.4/cmake/libprotobufd.a /home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf/protobuf-3.19.4/cmake/libprotobuf-lited.a /home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf/protobuf-3.19.4/cmake/libprotocd.a -lssl -lcrypto -lpthread -lresolv -o /home/vagrant/cpp/mysql_conn_app/main.exe
</code>```

gives :

```<code>/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::log_handler_init()':
./build/cdk/protocol/mysqlx/./cdk/protocol/mysqlx/protocol.cc:131: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Ok(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:947: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Error(unsigned short, cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:1146: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Expr_builder_base::set_call(cdk::protocol::mysqlx::api::Db_obj const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2562: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2631: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Expr_builder_base::var(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2013: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o):./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2874: more undefined references to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)' follow
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `void google::protobuf::internal::ArenaStringPtr::Set<google::protobuf::internal::ArenaStringPtr::EmptyDefault>(google::protobuf::internal::ArenaStringPtr::EmptyDefault, char const*, google::protobuf::Arena*)':
./build/cdk/protocol/mysqlx/./cdk/extra/protobuf/protobuf-3.19.4/src/google/protobuf/arenastring.h:200: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string const&, google::protobuf::Arena*)'
</code>```

Body:
After looking ant trying all links on the web i just can't figure what is wrong.
g++ version :

g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

This is my compilation line :

/usr/bin/g++ -fdiagnostics-color=always -Wall -std=c++11 -DSTATIC_CONCPP -I/home/vagrant/cpp/mysql-connector-cpp/include/ -I/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/ -I/home/vagrant/cpp/mysql-connector-cpp/common/ -I/home/vagrant/cpp/boost/ -I/home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf -g /home/vagrant/cpp/mysql_conn_app/main.cpp /home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread -lresolv -o /home/vagrant/cpp/mysql_conn_app/main.exe

This is the error:

/tmp/ccUnnhKN.o: In function `mysqlx::abi2::r0::string::traits<char>::from_str(mysqlx::abi2::r0::string&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/devapi/common.h:220: undefined reference to `mysqlx::abi2::r0::string::Impl::from_utf8(mysqlx::abi2::r0::string&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccUnnhKN.o: In function `mysqlx::abi2::r0::string::traits<char>::to_str[abi:cxx11](mysqlx::abi2::r0::string const&)':
/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/devapi/common.h:225: undefined reference to `mysqlx::abi2::r0::string::Impl::to_utf8[abi:cxx11](mysqlx::abi2::r0::string const&)'
/tmp/ccUnnhKN.o: In function `mysqlx::abi2::r0::SessionSettings::SessionSettings(mysqlx::abi2::r0::string const&)':
/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/devapi/settings.h:526: undefined reference to `mysqlx::abi2::r0::common::Settings_impl::set_from_uri(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::log_handler_init()':
./build/cdk/protocol/mysqlx/./cdk/protocol/mysqlx/protocol.cc:131: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Ok(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:947: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Error(unsigned short, cdk::foundation::string
....

what is wrong here ?

also when adding "-D_GLIBCXX_USE_CXX11_ABI=0" as suggested here:
still not working

/usr/bin/g++ -fdiagnostics-color=always -Wall -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -DSTATIC_CONCPP -I/home/vagrant/cpp/mysql-connector-cpp/include/ -I/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/ -I/home/vagrant/cpp/mysql-connector-cpp/common/ -I/home/vagrant/cpp/boost/ -I/home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf -g /home/vagrant/cpp/mysql_conn_app/main.cpp /home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread -lresolv -o /home/vagrant/cpp/mysql_conn_app/main.exe

gives :

/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::log_handler_init()':
./build/cdk/protocol/mysqlx/./cdk/protocol/mysqlx/protocol.cc:131: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Ok(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:947: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Error(unsigned short, cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:1146: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Expr_builder_base::set_call(cdk::protocol::mysqlx::api::Db_obj const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2562: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'

adding protobuf + -D_GLIBCXX_USE_CXX11_ABI=0  same error:

 /usr/bin/g++ -fdiagnostics-color=always -Wall -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -DSTATIC_CONCPP -I/home/vagrant/cpp/mysql-connector-cpp/include/ -I/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/ -I/home/vagrant/cpp/mysql-connector-cpp/common/ -I/home/vagrant/cpp/boost/ -I/home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf -g /home/vagrant/cpp/mysql_conn_app/main.cpp /home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a /home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf/protobuf-3.19.4/cmake/libprotobufd.a /home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf/protobuf-3.19.4/cmake/libprotobuf-lited.a /home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf/protobuf-3.19.4/cmake/libprotocd.a -lssl -lcrypto -lpthread -lresolv -o /home/vagrant/cpp/mysql_conn_app/main.exe

gives :

/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::log_handler_init()':
./build/cdk/protocol/mysqlx/./cdk/protocol/mysqlx/protocol.cc:131: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Ok(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:947: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Error(unsigned short, cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:1146: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Expr_builder_base::set_call(cdk::protocol::mysqlx::api::Db_obj const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2562: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2631: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Expr_builder_base::var(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2013: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o):./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2874: more undefined references to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)' follow
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `void google::protobuf::internal::ArenaStringPtr::Set<google::protobuf::internal::ArenaStringPtr::EmptyDefault>(google::protobuf::internal::ArenaStringPtr::EmptyDefault, char const*, google::protobuf::Arena*)':
./build/cdk/protocol/mysqlx/./cdk/extra/protobuf/protobuf-3.19.4/src/google/protobuf/arenastring.h:200: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string const&, google::protobuf::Arena*)'


问:
What is the accuracy of location determination in StartMonitroingSignificantLocationChanges?
As I understand, when StartMonitroingSignificantLocationChanges enter the didFinishLauching from apps suspended state it use accurate location, like startLocationUpdate?

Is it so? I mean can the cell tower 500m movement, trigger the app to get a GPS location or it just give approximate location?


问:
How can i configure webclient to use CA certificates provided by the server?
I have CA certificates(.crt files) of the server, and I want to enable SSL verification on the client application's WebClient call.

Currently i am using InsecureTrustManagerFactory which i want to avoid

Not sure whether I need to add the certificates to the trust store or the keystore?

where do I locate the trust store and keystore ?

how do I add the trust store / keystore to spring WebClient ?


问:
reduce encoder frame rate
I am tying to limit the frame rate to 5-10 fps.
The encoded frame are being sent though web-socket connection and my goal is to limit bandwidth to 1Mbps while having good quality for larger resolution.

my current attempt is:

```<code>    val format =
            MediaFormat.createVideoFormat(MediaFormat.MIMETYPE_VIDEO_VP8, size.width, size.height)
        format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
            MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
        format.setInteger(MediaFormat.KEY_BIT_RATE, 1000000);
        format.setInteger(MediaFormat.KEY_BITRATE_MODE,  MediaCodecInfo.EncoderCapabilities.BITRATE_MODE_CBR_FD);
        format.setInteger(MediaFormat.KEY_FRAME_RATE, 1);
        format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 5);
        format.setInteger(MediaFormat.KEY_MAX_FPS_TO_ENCODER, 1);
encoderInput = mEncoder!!.createInputSurface()
encoderInput.setFrameRate(1f,Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,Surface.CHANGE_FRAME_RATE_ALWAYS)

</code>```

I tired both setting the frame rate in the format and on the surface but it is still not limiting it. based on this discussion MediaCodec KEY_FRAME_RATE seems to be ignored

The bandwidth does follow the bit rate set in the format but not he frame rate so the quality is bad.

so how to reduce the frame rate ? preferably in a way that support older version of android.

Title: reduce encoder frame rate

Body:
I am tying to limit the frame rate to 5-10 fps.
The encoded frame are being sent though web-socket connection and my goal is to limit bandwidth to 1Mbps while having good quality for larger resolution.

my current attempt is:

    val format =
            MediaFormat.createVideoFormat(MediaFormat.MIMETYPE_VIDEO_VP8, size.width, size.height)
        format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
            MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
        format.setInteger(MediaFormat.KEY_BIT_RATE, 1000000);
        format.setInteger(MediaFormat.KEY_BITRATE_MODE,  MediaCodecInfo.EncoderCapabilities.BITRATE_MODE_CBR_FD);
        format.setInteger(MediaFormat.KEY_FRAME_RATE, 1);
        format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 5);
        format.setInteger(MediaFormat.KEY_MAX_FPS_TO_ENCODER, 1);
encoderInput = mEncoder!!.createInputSurface()
encoderInput.setFrameRate(1f,Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,Surface.CHANGE_FRAME_RATE_ALWAYS)

I tired both setting the frame rate in the format and on the surface but it is still not limiting it. based on this discussion MediaCodec KEY_FRAME_RATE seems to be ignored

The bandwidth does follow the bit rate set in the format but not he frame rate so the quality is bad.

so how to reduce the frame rate ? preferably in a way that support older version of android.