问:
RHLE8 conflicts to install mysql-community-server
I try to install mysql on my Red Hat Enterprise Linux 8 with the command :

```<code>sudo yum install mysql-community-server
</code>```

and I have this message:

Error: Transaction test error:

file /usr/lib64/mysql/plugin/authentication_fido_client.so from
install of mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64
conflicts with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/authentication_kerberos_client.so from
install of mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64
conflicts with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/authentication_ldap_sasl_client.so from
install of mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64
conflicts with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/authentication_oci_client.so from install
of mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64
conflicts with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/private/libfido2.so.1.5.0 from install of
mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64 conflicts
with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/libmysqlclient.so.21.2.28 conflicts between
attempted installs of mysql-community-libs-8.0.28-1.el8.x86_64 and
mysql-cluster-community-libs-8.0.28-1.el8.x86_64

file /usr/bin/mysql conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysql_config_editor conflicts between attempted installs
of mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysql_migrate_keyring conflicts between attempted
installs of mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqladmin conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlbinlog conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlcheck conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqldump conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlimport conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlpump conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlshow conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlslap conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/ibd2sdi conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/innochecksum conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/lz4_decompress conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/my_print_defaults conflicts between attempted installs
of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/myisam_ftdump conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/myisamchk conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/myisamlog conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/myisampack conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/mysql_secure_installation conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/mysql_ssl_rsa_setup conflicts between attempted installs
of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/mysql_tzinfo_to_sql conflicts between attempted installs
of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/mysql_upgrade conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/perror conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/zlib_decompress conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/adt_null.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/auth_socket.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_audit_api_message_emit.so
conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_keyring_file.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_log_filter_dragnet.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_log_sink_json.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_log_sink_syseventlog.so
conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_mysqlbackup.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_query_attributes.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_reference_cache.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_validate_password.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/connection_control.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/ddl_rewriter.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/group_replication.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/ha_example.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/ha_mock.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/innodb_engine.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/keyring_file.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/keyring_udf.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/libmemcached.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/libpluginmecab.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/locking_service.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/mypluglib.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/mysql_clone.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/mysql_no_login.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/rewrite_example.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/rewriter.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/semisync_master.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/semisync_replica.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/semisync_slave.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/semisync_source.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/validate_password.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/version_token.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/private/libprotobuf-lite.so.3.11.4 conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/private/libprotobuf.so.3.11.4 conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/sbin/mysqld conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

I don't understand the message, if someone can help me.

答:
Looks like you've already got the community cluster server installed.  Try this: yum list installed | grep mysql-community-server

If it's installed you can yum remove mysql-community-server and then attempt the cluster install.

Body:
I try to install mysql on my Red Hat Enterprise Linux 8 with the command :

sudo yum install mysql-community-server

and I have this message:

Error: Transaction test error:

file /usr/lib64/mysql/plugin/authentication_fido_client.so from
install of mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64
conflicts with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/authentication_kerberos_client.so from
install of mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64
conflicts with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/authentication_ldap_sasl_client.so from
install of mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64
conflicts with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/authentication_oci_client.so from install
of mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64
conflicts with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/private/libfido2.so.1.5.0 from install of
mysql-cluster-community-client-plugins-8.0.28-1.el8.x86_64 conflicts
with file from package
mysql-community-client-plugins-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/libmysqlclient.so.21.2.28 conflicts between
attempted installs of mysql-community-libs-8.0.28-1.el8.x86_64 and
mysql-cluster-community-libs-8.0.28-1.el8.x86_64

file /usr/bin/mysql conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysql_config_editor conflicts between attempted installs
of mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysql_migrate_keyring conflicts between attempted
installs of mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqladmin conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlbinlog conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlcheck conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqldump conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlimport conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlpump conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlshow conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/mysqlslap conflicts between attempted installs of
mysql-community-client-8.0.28-1.el8.x86_64 and
mysql-cluster-community-client-8.0.28-1.el8.x86_64

file /usr/bin/ibd2sdi conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/innochecksum conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/lz4_decompress conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/my_print_defaults conflicts between attempted installs
of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/myisam_ftdump conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/myisamchk conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/myisamlog conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/myisampack conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/mysql_secure_installation conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/mysql_ssl_rsa_setup conflicts between attempted installs
of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/mysql_tzinfo_to_sql conflicts between attempted installs
of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/mysql_upgrade conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/perror conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/bin/zlib_decompress conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/adt_null.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/auth_socket.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_audit_api_message_emit.so
conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_keyring_file.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_log_filter_dragnet.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_log_sink_json.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_log_sink_syseventlog.so
conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_mysqlbackup.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_query_attributes.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_reference_cache.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/component_validate_password.so conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/connection_control.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/ddl_rewriter.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/group_replication.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/ha_example.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/ha_mock.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/innodb_engine.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/keyring_file.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/keyring_udf.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/libmemcached.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/libpluginmecab.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/locking_service.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/mypluglib.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/mysql_clone.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/mysql_no_login.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/rewrite_example.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/rewriter.so conflicts between attempted
installs of mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/semisync_master.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/semisync_replica.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/semisync_slave.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/semisync_source.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/validate_password.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/plugin/version_token.so conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/private/libprotobuf-lite.so.3.11.4 conflicts
between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/lib64/mysql/private/libprotobuf.so.3.11.4 conflicts between
attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

file /usr/sbin/mysqld conflicts between attempted installs of
mysql-cluster-community-server-8.0.28-1.el8.x86_64 and
mysql-community-server-8.0.28-1.el8.x86_64

I don't understand the message, if someone can help me.


来源: stackexchange

问:
Kubernetes Deployment and Service named ports
Hope life is great for everyone. I am trying to figure to use named ports for Deployment and Service. For pods and service using named ports works fine. But doesn't for Deployment and Service. I dig and no answers are working, example https://github.com/GoogleCloudPlatform/k8s-multicluster-ingress/issues/196 and there is one in Stack Overflow which doesn't helps much, How to make use of Kubernetes port names?

This is the YAML files.

deployment-named-port.yaml

```<code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: test-named-ports
  name: test-named-ports
spec:
  replicas: 3
  selector:
    matchLabels:
      app: test-named-ports
  strategy: {}
  template:
    metadata:
      labels:
        app: test-named-ports
    spec:
      containers:
      - image: nginx
        name: nginx
        ports:
        - containerPort: 80
          name: nginx-port
</code>```

named-port-svc.yaml

```<code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: NodePort
  selector:
    app: test-named-ports
  ports:
    - port: nginx-port
      targetPort: nginx-port
      nodePort: 30007

vagrant@kubemaster:~$ kubectl apply -f named-port.yaml
deployment.apps/test-nameed-ports created

vagrant@kubemaster:~$ kubectl apply -f named-port-svc.yaml
error: error validating "named-port-svc.yaml": error validating data: ValidationError(Service.spec.ports[0].port): invalid type for io.k8s.api.core.v1.ServicePort.port: got "string", expected "integer"; if you choose to ignore these errors, turn validation off with --validate=false
</code>```

Can someone please help me. Appreciate all your support.

Thanks,

Joe Antony

答:
The port and targetPort should 80 not string nginx-port.

```<code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: NodePort
  selector:
    app: test-named-ports
  ports:
    - name: nginx-port
      port: 80
      targetPort: 80
      nodePort: 30007

</code>```

ContentLicense: CC BY-SA 4.0

Body:
Hope life is great for everyone. I am trying to figure to use named ports for Deployment and Service. For pods and service using named ports works fine. But doesn't for Deployment and Service. I dig and no answers are working, example https://github.com/GoogleCloudPlatform/k8s-multicluster-ingress/issues/196 and there is one in Stack Overflow which doesn't helps much, How to make use of Kubernetes port names?

This is the YAML files.

deployment-named-port.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: test-named-ports
  name: test-named-ports
spec:
  replicas: 3
  selector:
    matchLabels:
      app: test-named-ports
  strategy: {}
  template:
    metadata:
      labels:
        app: test-named-ports
    spec:
      containers:
      - image: nginx
        name: nginx
        ports:
        - containerPort: 80
          name: nginx-port

named-port-svc.yaml

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: NodePort
  selector:
    app: test-named-ports
  ports:
    - port: nginx-port
      targetPort: nginx-port
      nodePort: 30007

vagrant@kubemaster:~$ kubectl apply -f named-port.yaml
deployment.apps/test-nameed-ports created

vagrant@kubemaster:~$ kubectl apply -f named-port-svc.yaml
error: error validating "named-port-svc.yaml": error validating data: ValidationError(Service.spec.ports[0].port): invalid type for io.k8s.api.core.v1.ServicePort.port: got "string", expected "integer"; if you choose to ignore these errors, turn validation off with --validate=false

Can someone please help me. Appreciate all your support.

Thanks,

Joe Antony

Body:
The port and targetPort should 80 not string nginx-port.

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: NodePort
  selector:
    app: test-named-ports
  ports:
    - name: nginx-port
      port: 80
      targetPort: 80
      nodePort: 30007


问:
Compiling a library with a newer set of dependency in haskell
Taking some not so old haskell project hdocs (last updated November 2020...).

If I build it with the original Stack file, everything is fine. And I can still build upon it on my own projects with the other libraries of that LTS which works well together. Reproducibl-ish build is good.

Now I want to update its dependencies

if I build it (after
ghcup set ghc 9.0.2) with
cabal v1-build
I get nonsense about "fail backjumping" and "private dependencies"

If I either

cabal v2-build (after
ghcup set ghc 9.0.2) and let it think hard

or if I build it using stack build

#stack.yaml
flags: {}
packages:
- '.'
resolver:  nightly-2022-02-11
extra-deps:
- haddock-api-2.25.1
```
<p>Then in both cases I get C pre-processing errors (!)</p>
```Building library for hdocs-0.5.5.0..

src/HDocs/Base.hs:69:5: error:
     error: function-like macro 'MIN_VERSION_haddock_library' is not defined
   |
69 | #if MIN_VERSION_haddock_library(1,8,0)
   |     ^
#if MIN_VERSION_haddock_library(1,8,0)
    ^
...
```

The error is not about some code but about the build process itself.

Am I missing something obvious in haskell ecosystem ?

答:
According to the relevant section of the Cabal User Guide, Cabal provides a MIN_VERSION macro "for each package depended on via build-depends. The hdocs.cabal currently on GitHub only specifies haddock-library in the conditional parts of build-depends, so it would be missing for anything above GHC 8.10. That being so, if we are to keep the cabal file organised in the same way, this specific error can be avoided by specifying the missing dependencies for GHC 9.0:

```<code>-- In the library section of hdocs.cabal:
  if impl(ghc == 9.0.*)
    build-depends:
      ghc == 9.0.*,
      haddock-api >= 2.25 && < 2.26,
      haddock-library == 1.10.*
</code>```

Body:
Taking some not so old haskell project hdocs (last updated November 2020...).

If I build it with the original Stack file, everything is fine. And I can still build upon it on my own projects with the other libraries of that LTS which works well together. Reproducibl-ish build is good.

Now I want to update its dependencies

if I build it (after
ghcup set ghc 9.0.2) with
cabal v1-build
I get nonsense about "fail backjumping" and "private dependencies"

If I either

cabal v2-build (after
ghcup set ghc 9.0.2) and let it think hard

or if I build it using stack build

#stack.yaml
flags: {}
packages:
- '.'
resolver:  nightly-2022-02-11
extra-deps:
- haddock-api-2.25.1

Then in both cases I get C pre-processing errors (!)

Building library for hdocs-0.5.5.0..

src/HDocs/Base.hs:69:5: error:
     error: function-like macro 'MIN_VERSION_haddock_library' is not defined
   |
69 | #if MIN_VERSION_haddock_library(1,8,0)
   |     ^
#if MIN_VERSION_haddock_library(1,8,0)
    ^
...

The error is not about some code but about the build process itself.

Am I missing something obvious in haskell ecosystem ?

Body:
According to the relevant section of the Cabal User Guide, Cabal provides a MIN_VERSION macro "for each package depended on via build-depends. The hdocs.cabal currently on GitHub only specifies haddock-library in the conditional parts of build-depends, so it would be missing for anything above GHC 8.10. That being so, if we are to keep the cabal file organised in the same way, this specific error can be avoided by specifying the missing dependencies for GHC 9.0:

-- In the library section of hdocs.cabal:
  if impl(ghc == 9.0.*)
    build-depends:
      ghc == 9.0.*,
      haddock-api >= 2.25 && < 2.26,
      haddock-library == 1.10.*


问:
Selenium chrome driver unable to locate input element
Getting error when trying to locate the input element. Tried locating by xpath and className.

HTML of the Input Element:

```<code><input data-v-9182d0dc="" type="text" id="filterElement" data-cy="v-search-input" autocomplete="off" placeholder="Type a name or a number" class="padding-right-30 round">
</code>```

Xpath for this element:

```<code>//*[@id="filterElement"]
</code>```

Full Xpath for this element: /html/body/div[2]/div[5]/div/div[2]/div/div[1]/div/div/div[2]/input

Statement to find the element

```<code>temp=driver.find_element_by_xpath('/html/body/div[2]/div[5]/div/div[2]/div/div[1]/div/div/div[2]/input')
</code>```

Getting below error message:

```<code>selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[2]/div[5]/div/div[2]/div/div[1]/div/div/div[2]/input"}
</code>```

Update: The element seems to be inside an iframe. Not sure how this comes into play when selecting an element

答:
To locate the clickable element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies:

Using CSS_SELECTOR:

```<code>element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input#filterElement[data-cy='v-search-input']")))
</code>```

Using XPATH:

```<code>element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@id='filterElement' and @data-cy='v-search-input']")))
</code>```

Note : You have to add the following imports :

```<code>from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
</code>```

References

You can find a couple of relevant discussions on NoSuchElementException in:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element while trying to click Next button with selenium

selenium in python : NoSuchElementException: Message: no such element: Unable to locate element

Body:
Getting error when trying to locate the input element. Tried locating by xpath and className.

HTML of the Input Element:

<input data-v-9182d0dc="" type="text" id="filterElement" data-cy="v-search-input" autocomplete="off" placeholder="Type a name or a number" class="padding-right-30 round">

Xpath for this element:

//*[@id="filterElement"]

Full Xpath for this element: /html/body/div[2]/div[5]/div/div[2]/div/div[1]/div/div/div[2]/input

Statement to find the element

temp=driver.find_element_by_xpath('/html/body/div[2]/div[5]/div/div[2]/div/div[1]/div/div/div[2]/input')

Getting below error message:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[2]/div[5]/div/div[2]/div/div[1]/div/div/div[2]/input"}

Update: The element seems to be inside an iframe. Not sure how this comes into play when selecting an element

Body:
To locate the clickable element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies:

Using CSS_SELECTOR:

element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input#filterElement[data-cy='v-search-input']")))

Using XPATH:

element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@id='filterElement' and @data-cy='v-search-input']")))

Note : You have to add the following imports :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

References

You can find a couple of relevant discussions on NoSuchElementException in:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element while trying to click Next button with selenium

selenium in python : NoSuchElementException: Message: no such element: Unable to locate element


问:
How to convert TIMETZ to TIMESTAMPTZ in Postgres
I have a column of timestamps with the type TIMETZ. How do I copy it to an empty column with the type TIMESTAMPTZ with today's date?</p>

答:
Like so:</p>
```<code>--Given this:
select current_date  + '08:00'::timetz;
2022-02-11 08:00:00-08

--Do this:
update some_table set timestamp_tz_col = current_date + time_tz_col;

</code>```

Body:
Like so:

--Given this:
select current_date  + '08:00'::timetz;
2022-02-11 08:00:00-08

--Do this:
update some_table set timestamp_tz_col = current_date + time_tz_col;


问:
creating data stream through logstash
I have installed elasticsearch cluster v 7.14.

I have created ILM policy and Index template. However data stream parameters mentioned under logstash pipeline file are giving error.

ILM policy -

```<code>{
  "testpolicy" : {
    "version" : 1,
    "modified_date" : "2021-08-28T02:58:25.942Z",
    "policy" : {
      "phases" : {
        "hot" : {
          "min_age" : "0ms",
          "actions" : {
            "rollover" : {
              "max_primary_shard_size" : "900mb",
              "max_age" : "2d"
            },
            "set_priority" : {
              "priority" : 100
            }
          }
        },
        "delete" : {
          "min_age" : "2d",
          "actions" : {
            "delete" : {
              "delete_searchable_snapshot" : true
            }
          }
        }
      }
    },
    "in_use_by" : {
      "indices" : [ ],
      "data_streams" : [ ],
      "composable_templates" : [ ]
    }
  }
}
</code>```

Index temaplate -

```<code>{
  "index_templates" : [
    {
      "name" : "access_template",
      "index_template" : {
        "index_patterns" : [
          "test-data-stream*"
        ],
        "template" : {
          "settings" : {
            "index" : {
              "number_of_shards" : "1",
              "number_of_replicas" : "0"
            }
          },
          "mappings" : {
            "_routing" : {
              "required" : false
            },
            "dynamic_date_formats" : [
              "strict_date_optional_time",
              "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"
            ],
            "numeric_detection" : true,
            "_source" : {
              "excludes" : [ ],
              "includes" : [ ],
              "enabled" : true
            },
            "dynamic" : true,
            "dynamic_templates" : [ ],
            "date_detection" : true
          }
        },
        "composed_of" : [ ],
        "priority" : 500,
        "version" : 1,
        "data_stream" : {
          "hidden" : false
        }
      }
    }
  ]
}
</code>```

logstash pipeline config file -

```<code>input {
  beats {
    port => 5044
  }
}

filter {

 if [log_type] == "access_server" and [app_id] == "pa"
  {
     grok {
    match => {
    "message" => "%{YEAR}-%{MONTHNUM}-%{MONTHDAY}[T ]%{HOUR}:%{MINUTE}(?::?%{SECOND})\| %{USERNAME:exchangeId}\| %{DATA:trackingId}\| %{NUMBER:RoundTrip:int}%{SPACE}ms\| %{NUMBER:ProxyRoundTrip:int}%{SPACE}ms\| %{NUMBER:UserInfoRoundTrip:int}%{SPACE}ms\| %{DATA:Resource}\| %{DATA:subject}\| %{DATA:authmech}\| %{DATA:scopes}\| %{IPV4:Client}\| %{WORD:method}\| %{DATA:Request_URI}\| %{INT:response_code}\| %{DATA:failedRuleType}\| %{DATA:failedRuleName}\| %{DATA:APP_Name}\| %{DATA:Resource_Name}\| %{DATA:Path_Prefix}"
    }
    }
    mutate {
             replace => {
               "[type]" => "access_server"
             }
           }
  }
}

output {
   if [log_type] == "access_server" {
  elasticsearch {
    hosts => ['http://10.10.10.76:9200']
        user => elastic
    password => xxx
     data_stream => "true"
     data_stream_type => "logs"
     data_stream_dataset => "access"
     data_stream_namespace => "default"
     ilm_rollover_alias => "access"
     ilm_pattern => "000001"
     ilm_policy => "testpolicy"
     template => "/tmp/access_template"
     template_name => "access_template"
      }
 }
   elasticsearch {
    hosts => ['http://10.10.10.76:9200']
    index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
    user => elastic
    password => xxx
  }
}
</code>```

After all deployment done, can only see system indices but data stream is not created.

```<code>[2021-08-28T12:42:50,103][ERROR][logstash.outputs.elasticsearch][main] Invalid data stream configuration, following parameters are not supported: {"template"=>"/tmp/pingaccess_template", "ilm_pattern"=>"000001", "template_name"=>"pingaccess_template", "ilm_rollover_alias"=>"pingaccess", "ilm_policy"=>"testpolicy"}

[2021-08-28T12:42:50,547][ERROR][logstash.javapipeline    ][main] Pipeline error {:pipeline_id=>"main", :exception=>#<LogStash::ConfigurationError: Invalid data stream configuration: ["template", "ilm_pattern", "template_name", "ilm_rollover_alias", "ilm_policy"]>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-11.0.2-java/lib/logstash/outputs/elasticsearch/data_stream_support.rb:57:in `check_data_stream_config!'"

[2021-08-28T12:42:50,702][ERROR][logstash.agent           ] Failed to execute action {:id=>:main, :action_type=>LogStash::ConvergeResult::FailedAction, :message=>"Could not execute action: PipelineAction::Create<main>, action_result: false", :backtrace=>nil}
</code>```

error is saying parameters like template"=>"/tmp/pingaccess_template", "ilm_pattern"=>"000001", "template_name"=>"pingaccess_template", "ilm_rollover_alias"=>"pingaccess", "ilm_policy"=>"testpolicy" are not valid but in below link they are mentioned.

https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-data-streams

答:
The solution is to use logstash without be "aware" of data_stream.

FIRST of all (before running logstash) create your ILM and index_template BUT adding the "index.lifecycle.name" in the settings. That way, you are linking the template and ILM. Also, don't forget the data_stream in the index template.

```<code>{
  "index_templates" : [
    {
      "name" : "access_template",
      "index_template" : {
        "index_patterns" : [
          "test-data-stream*"
        ],
        "template" : {
          "settings" : {
            "index" : {
              "number_of_shards" : "1",
              "number_of_replicas" : "0",
              "index.lifecycle.name": "testpolicy"
            }
          },
          "mappings" : {
          ...
          }
        },
        "composed_of" : [ ],
        "priority" : 500,
        "version" : 1,
        "data_stream" : {
          "hidden" : false
        }
      }
    }
  ]
}
</code>```

Keep Logstash output like if data_stream doesn't exist but add action => create. This is because you can't use "index" API with data streams. Need the _create API call.

```<code>    output { elasticsearch {
      hosts => ['http://10.10.10.76:9200']
      index => "test-data-stream"
      user => elastic
      password => xxx
      action => "create"
    }
</code>```

That way, logstash will output to ES, but the index template will be applied automatically (because of pattern match) and also the ILM and data_stream will be applied.

Important: To make it work, you need to start from scratch. If the index "test-data-stream" already exists in ES (as a traditional index), then data_stream will NOT be created. Make the test with another index name to make sure it works.

Title: creating data stream through logstash

Body:
I have installed elasticsearch cluster v 7.14.

I have created ILM policy and Index template. However data stream parameters mentioned under logstash pipeline file are giving error.

ILM policy -

{
  "testpolicy" : {
    "version" : 1,
    "modified_date" : "2021-08-28T02:58:25.942Z",
    "policy" : {
      "phases" : {
        "hot" : {
          "min_age" : "0ms",
          "actions" : {
            "rollover" : {
              "max_primary_shard_size" : "900mb",
              "max_age" : "2d"
            },
            "set_priority" : {
              "priority" : 100
            }
          }
        },
        "delete" : {
          "min_age" : "2d",
          "actions" : {
            "delete" : {
              "delete_searchable_snapshot" : true
            }
          }
        }
      }
    },
    "in_use_by" : {
      "indices" : [ ],
      "data_streams" : [ ],
      "composable_templates" : [ ]
    }
  }
}

Index temaplate -

{
  "index_templates" : [
    {
      "name" : "access_template",
      "index_template" : {
        "index_patterns" : [
          "test-data-stream*"
        ],
        "template" : {
          "settings" : {
            "index" : {
              "number_of_shards" : "1",
              "number_of_replicas" : "0"
            }
          },
          "mappings" : {
            "_routing" : {
              "required" : false
            },
            "dynamic_date_formats" : [
              "strict_date_optional_time",
              "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"
            ],
            "numeric_detection" : true,
            "_source" : {
              "excludes" : [ ],
              "includes" : [ ],
              "enabled" : true
            },
            "dynamic" : true,
            "dynamic_templates" : [ ],
            "date_detection" : true
          }
        },
        "composed_of" : [ ],
        "priority" : 500,
        "version" : 1,
        "data_stream" : {
          "hidden" : false
        }
      }
    }
  ]
}

logstash pipeline config file -

input {
  beats {
    port => 5044
  }
}

filter {

 if [log_type] == "access_server" and [app_id] == "pa"
  {
     grok {
    match => {
    "message" => "%{YEAR}-%{MONTHNUM}-%{MONTHDAY}[T ]%{HOUR}:%{MINUTE}(?::?%{SECOND})\| %{USERNAME:exchangeId}\| %{DATA:trackingId}\| %{NUMBER:RoundTrip:int}%{SPACE}ms\| %{NUMBER:ProxyRoundTrip:int}%{SPACE}ms\| %{NUMBER:UserInfoRoundTrip:int}%{SPACE}ms\| %{DATA:Resource}\| %{DATA:subject}\| %{DATA:authmech}\| %{DATA:scopes}\| %{IPV4:Client}\| %{WORD:method}\| %{DATA:Request_URI}\| %{INT:response_code}\| %{DATA:failedRuleType}\| %{DATA:failedRuleName}\| %{DATA:APP_Name}\| %{DATA:Resource_Name}\| %{DATA:Path_Prefix}"
    }
    }
    mutate {
             replace => {
               "[type]" => "access_server"
             }
           }
  }
}

output {
   if [log_type] == "access_server" {
  elasticsearch {
    hosts => ['http://10.10.10.76:9200']
        user => elastic
    password => xxx
     data_stream => "true"
     data_stream_type => "logs"
     data_stream_dataset => "access"
     data_stream_namespace => "default"
     ilm_rollover_alias => "access"
     ilm_pattern => "000001"
     ilm_policy => "testpolicy"
     template => "/tmp/access_template"
     template_name => "access_template"
      }
 }
   elasticsearch {
    hosts => ['http://10.10.10.76:9200']
    index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
    user => elastic
    password => xxx
  }
}

After all deployment done, can only see system indices but data stream is not created.

[2021-08-28T12:42:50,103][ERROR][logstash.outputs.elasticsearch][main] Invalid data stream configuration, following parameters are not supported: {"template"=>"/tmp/pingaccess_template", "ilm_pattern"=>"000001", "template_name"=>"pingaccess_template", "ilm_rollover_alias"=>"pingaccess", "ilm_policy"=>"testpolicy"}

[2021-08-28T12:42:50,547][ERROR][logstash.javapipeline    ][main] Pipeline error {:pipeline_id=>"main", :exception=>#<LogStash::ConfigurationError: Invalid data stream configuration: ["template", "ilm_pattern", "template_name", "ilm_rollover_alias", "ilm_policy"]>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-11.0.2-java/lib/logstash/outputs/elasticsearch/data_stream_support.rb:57:in `check_data_stream_config!'"

[2021-08-28T12:42:50,702][ERROR][logstash.agent           ] Failed to execute action {:id=>:main, :action_type=>LogStash::ConvergeResult::FailedAction, :message=>"Could not execute action: PipelineAction::Create, action_result: false", :backtrace=>nil}

error is saying parameters like template"=>"/tmp/pingaccess_template", "ilm_pattern"=>"000001", "template_name"=>"pingaccess_template", "ilm_rollover_alias"=>"pingaccess", "ilm_policy"=>"testpolicy" are not valid but in below link they are mentioned.

https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-data-streams

Body:
The solution is to use logstash without be "aware" of data_stream.

FIRST of all (before running logstash) create your ILM and index_template BUT adding the "index.lifecycle.name" in the settings. That way, you are linking the template and ILM. Also, don't forget the data_stream in the index template.

{
  "index_templates" : [
    {
      "name" : "access_template",
      "index_template" : {
        "index_patterns" : [
          "test-data-stream*"
        ],
        "template" : {
          "settings" : {
            "index" : {
              "number_of_shards" : "1",
              "number_of_replicas" : "0",
              "index.lifecycle.name": "testpolicy"
            }
          },
          "mappings" : {
          ...
          }
        },
        "composed_of" : [ ],
        "priority" : 500,
        "version" : 1,
        "data_stream" : {
          "hidden" : false
        }
      }
    }
  ]
}

Keep Logstash output like if data_stream doesn't exist but add action => create. This is because you can't use "index" API with data streams. Need the _create API call.

    output { elasticsearch {
      hosts => ['http://10.10.10.76:9200']
      index => "test-data-stream"
      user => elastic
      password => xxx
      action => "create"
    }

That way, logstash will output to ES, but the index template will be applied automatically (because of pattern match) and also the ILM and data_stream will be applied.

Important: To make it work, you need to start from scratch. If the index "test-data-stream" already exists in ES (as a traditional index), then data_stream will NOT be created. Make the test with another index name to make sure it works.


问:
How to return the difference between two Objects having array and return the difference value dynamically
Let's say I have two objects of arrays:

```<code>const newObj = {
      description: "abcd",
      type: "anything",
      list: [
        { id: 1, name: "Peter" },
        { id: 2, name: "Cathenna" },
        { id: 3, name: "Chiyo" }
      ]
    }

   const oldObj = {
      description: "wwew",
      type: "anything",
      list: [
        { id: 1, name: "Amara" },
        { id: 2, name: "shinzo" },
        { id: 3, name: "Chiyo" }
      ]
    }
</code>```

I want to find all the updated data in newObj objects. Ex, description of oldObj is updated to "abcd" in newObj and in list name of two objects has been updated. So, my expected output is:

```<code>const extractObjDiff = {
      description: "abcd",
      list: [
        { id: 1, name: "Peter" },
        { id: 2, name: "Cathenna" }
      ]
    }
</code>```

I have tried below code but it's not working for array list.

function extractObjDiff(newObj, oldObj) {
  var r = {};
  for (var prop in newObj) {
    if (!oldObj.hasOwnProperty(prop)) {
      if (Array.isArray(newObj)) {
        r = newObj;
      } else {
        r[prop] = newObj[prop];
      }
    } else if (newObj[prop] === Object(newObj[prop])) {
      var difference = newObj[prop].length !== oldObj[prop].length ? newObj[prop] : extractObjDiff(newObj[prop], oldObj[prop], []);
      if (Object.keys(difference).length > 0) r[prop] = difference;
    } else if (newObj[prop] !== oldObj[prop]) {
      if (newObj[prop] === undefined)
        r[prop] = 'undefined';
      if (newObj[prop] === null)
        r[prop] = null;
      else if (typeof newObj[prop] === 'function')
        r[prop] = 'function';
      else if (typeof newObj[prop] === 'object')
        r[prop] = 'object'
      else if (Array.isArray(newObj))
        r = newObj;
      else
        r[prop] = newObj[prop];
    }
  }
  return r;
}```

答:
I have added 2 functions, first one give your expected output and second one give the every changes in the new object.

const newObj = {
  description: "abcd",
  type: "anything",
  list: [
    { id: 1, name: "Peter" },
    { id: 2, name: "Cathenna" },
    { id: 3, name: "Chiyo" }
  ]
};

const oldObj = {
  description: "wwew",
  type: "anything",
  list: [
    { id: 1, name: "Amara" },
    { id: 2, name: "shinzo" },
    { id: 3, name: "Chiyo" }
  ]
};

const findSubChanges = (oldObj, newObj) => {
  let changes=[]
  for (const i in oldObj) {
    if (oldObj[i] instanceof Object) {
      let isChange=false
      for (const j in oldObj[i]){
        if(oldObj[i][j] !== newObj[i][j]){
          isChange=true
          break
        }
      }
      if (isChange){
        changes[i] = newObj[i]
      }
    } else {
      if (oldObj[i] !== newObj[i]) {
        changes[i] = newObj[i];
      }
    }
  }
  return changes
};

const findChanges = (oldObj, newObj) => {
  let changes={}
  for (const i in oldObj) {
    if (oldObj[i] instanceof Object) {
      const change = findSubChanges(oldObj[i], newObj[i]);
      if (change) {
        changes[i] = change
      }
    } else {
      if (oldObj[i] !== newObj[i]) {
        changes[i] = newObj[i];
      }
    }
  }
  return changes
};

const extractObjDiff=findChanges(oldObj, newObj)
console.log(extractObjDiff);```
</div>
</div>
</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const newObj = {
  description: "abcd",
  type: "anything",
  list: [
    { id: 1, name: "Peter" },
    { id: 2, name: "Cathenna" },
    { id: 3, name: "Chiyo" }
  ]
};

const oldObj = {
  description: "wwew",
  type: "anything",
  list: [
    { id: 1, name: "Amara" },
    { id: 2, name: "shinzo" },
    { id: 3, name: "Chiyo" }
  ]
};

const isArray = (item) => item instanceof Array;
const isJSONObject = (item) =>
  item instanceof Object && !(item instanceof Array);

const findEveryChanges = (oldObj, newObj) => {
  if (
    (isArray(oldObj) && isArray(newObj)) ||
    (isJSONObject(oldObj) && isJSONObject(newObj))
  ) {
    let changes = isArray(oldObj) ? [] : {};
    for (const i in oldObj) {
      if (oldObj[i] instanceof Object) {
        const change = findEveryChanges(oldObj[i], newObj[i]);
        if (change) {
          changes[i] = change;
        }
      } else {
        if (oldObj[i] !== newObj[i]) {
          changes[i] = newObj[i];
        }
      }
    }
    if (Object.keys(changes).length > 0) {
      return changes;
    }
    return;
  }
  if (oldObj !== newObj) {
    return newObj;
  }
  return;
};

console.log(findEveryChanges(oldObj, newObj));</code>```

Body:
Let's say I have two objects of arrays:

const newObj = {
      description: "abcd",
      type: "anything",
      list: [
        { id: 1, name: "Peter" },
        { id: 2, name: "Cathenna" },
        { id: 3, name: "Chiyo" }
      ]
    }

   const oldObj = {
      description: "wwew",
      type: "anything",
      list: [
        { id: 1, name: "Amara" },
        { id: 2, name: "shinzo" },
        { id: 3, name: "Chiyo" }
      ]
    }

I want to find all the updated data in newObj objects. Ex, description of oldObj is updated to "abcd" in newObj and in list name of two objects has been updated. So, my expected output is:

const extractObjDiff = {
      description: "abcd",
      list: [
        { id: 1, name: "Peter" },
        { id: 2, name: "Cathenna" }
      ]
    }

I have tried below code but it's not working for array list.

function extractObjDiff(newObj, oldObj) {
  var r = {};
  for (var prop in newObj) {
    if (!oldObj.hasOwnProperty(prop)) {
      if (Array.isArray(newObj)) {
        r = newObj;
      } else {
        r[prop] = newObj[prop];
      }
    } else if (newObj[prop] === Object(newObj[prop])) {
      var difference = newObj[prop].length !== oldObj[prop].length ? newObj[prop] : extractObjDiff(newObj[prop], oldObj[prop], []);
      if (Object.keys(difference).length > 0) r[prop] = difference;
    } else if (newObj[prop] !== oldObj[prop]) {
      if (newObj[prop] === undefined)
        r[prop] = 'undefined';
      if (newObj[prop] === null)
        r[prop] = null;
      else if (typeof newObj[prop] === 'function')
        r[prop] = 'function';
      else if (typeof newObj[prop] === 'object')
        r[prop] = 'object'
      else if (Array.isArray(newObj))
        r = newObj;
      else
        r[prop] = newObj[prop];
    }
  }
  return r;
}

Body:
I have added 2 functions, first one give your expected output and second one give the every changes in the new object.

const newObj = {
  description: "abcd",
  type: "anything",
  list: [
    { id: 1, name: "Peter" },
    { id: 2, name: "Cathenna" },
    { id: 3, name: "Chiyo" }
  ]
};

const oldObj = {
  description: "wwew",
  type: "anything",
  list: [
    { id: 1, name: "Amara" },
    { id: 2, name: "shinzo" },
    { id: 3, name: "Chiyo" }
  ]
};

const findSubChanges = (oldObj, newObj) => {
  let changes=[]
  for (const i in oldObj) {
    if (oldObj[i] instanceof Object) {
      let isChange=false
      for (const j in oldObj[i]){
        if(oldObj[i][j] !== newObj[i][j]){
          isChange=true
          break
        }
      }
      if (isChange){
        changes[i] = newObj[i]
      }
    } else {
      if (oldObj[i] !== newObj[i]) {
        changes[i] = newObj[i];
      }
    }
  }
  return changes
};

const findChanges = (oldObj, newObj) => {
  let changes={}
  for (const i in oldObj) {
    if (oldObj[i] instanceof Object) {
      const change = findSubChanges(oldObj[i], newObj[i]);
      if (change) {
        changes[i] = change
      }
    } else {
      if (oldObj[i] !== newObj[i]) {
        changes[i] = newObj[i];
      }
    }
  }
  return changes
};

const extractObjDiff=findChanges(oldObj, newObj)
console.log(extractObjDiff);

const newObj = {
  description: "abcd",
  type: "anything",
  list: [
    { id: 1, name: "Peter" },
    { id: 2, name: "Cathenna" },
    { id: 3, name: "Chiyo" }
  ]
};

const oldObj = {
  description: "wwew",
  type: "anything",
  list: [
    { id: 1, name: "Amara" },
    { id: 2, name: "shinzo" },
    { id: 3, name: "Chiyo" }
  ]
};

const isArray = (item) => item instanceof Array;
const isJSONObject = (item) =>
  item instanceof Object && !(item instanceof Array);

const findEveryChanges = (oldObj, newObj) => {
  if (
    (isArray(oldObj) && isArray(newObj)) ||
    (isJSONObject(oldObj) && isJSONObject(newObj))
  ) {
    let changes = isArray(oldObj) ? [] : {};
    for (const i in oldObj) {
      if (oldObj[i] instanceof Object) {
        const change = findEveryChanges(oldObj[i], newObj[i]);
        if (change) {
          changes[i] = change;
        }
      } else {
        if (oldObj[i] !== newObj[i]) {
          changes[i] = newObj[i];
        }
      }
    }
    if (Object.keys(changes).length > 0) {
      return changes;
    }
    return;
  }
  if (oldObj !== newObj) {
    return newObj;
  }
  return;
};

console.log(findEveryChanges(oldObj, newObj));


问:
CSS animation to repeat every nth second
I am animating a svg element currently like following

.r1 {
     transform-box: fill-box;
     transform-origin: 50% 50%;
     animation-name: simpleRotation,xRotation;
     animation-delay: 0s, 2s;
     animation-duration: 2s;
     animation-iteration-count: 1, 1;
     animation-timing-function: linear;
     animation-direction: normal;
     animation-fill-mode: forwards;
}

@keyframes simpleRotation {
     from {
         transform: rotate(0deg);
    }
     to {
         transform: rotate(359deg);

    }
}
@keyframes xRotation {
     from {
         transform: rotateX(0deg);
    }
     to {
         transform: rotateX(359deg);
    }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">
<rect class="r1" id="r1" x="10" y="10" width="10" height="10" stroke="black" stroke-width="0.25" fill="orange"></rect>
    </svg></code>```

Is it possible to queue the animations (with javascript) in a way so that every 2s the animation runs one after another in a loop such as simpleRotation(0-2s);xRotation(2-4s);simpleRotation(4-6s);xRotation(6-8s);simpleRotation(8-10s);.....

答:
An alternative to ccprog's svg SMIL approach might be using the Web Animations API

The keyframe animation can be translated to an animation object like this

```<code>let ani1 = animEl.animate(
  [{
    transform: "rotate(0deg)"
  }, {
    transform: "rotate(359deg)"
  }], {
    delay: 500,
    duration: 1000,
    iterations: 1
  }
);
</code>```

See also: MDN: Using the Web Animations API

Example

let animEl = document.querySelector(".rect1");

let ani1 = animEl.animate(
  [{
    transform: "rotate(0deg)"
  }, {
    transform: "rotate(359deg)"
  }], {
    delay: 500,
    duration: 1000,
    iterations: 1
  }
);

let ani2 = animEl.animate(
  [{
    transform: "rotateX(0deg)"
  }, {
    transform: "rotateX(359deg)"
  }], {
    delay: 500,
    duration: 1000,
    iterations: 1,
  }
);
// pause 2. animation
ani2.pause();

// chain animations
ani1.onfinish = function() {
  ani2.play();
};

ani2.onfinish = function() {
  ani1.play();
};```
<pre class="snippet-code-css lang-css prettyprint-override"><code>svg {
  border: 1px solid #ccc;
  display: block;
  width: 10em
}</code>```

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <rect class="rect1" id="r1" x="25" y="25" width="50" height="50" stroke="black" stroke-width="0.25" fill="orange" transform-origin="50 50" ></rect>
</svg>```
</div>
</div>
</p>
<p>We pause the second on start animation via</p>
``` ani2.pause();
```
<p>and add an eventListener to start the second animation after the first one has finished.</p>
```ani1.onfinish = function() {
  ani2.play();
};
```

Edit you could also use premises as described by Dan Wilson

Don't miss out on the power of svg's SMIL animation

Especially when it comes to svg related animations, they still offer many bells and whistles not available in css animations like

Sequential animations:

<animate[...] begin="firstAnimation.end" />

The ability to start a consecutive animation (without any calculations of previous duration) via begin property is just awesome – this elegant concept should have been adopted to corresponding css animation methods.

Move elements along paths

self contained animations – like loading spinners
... svg wins!

Caniuse:

SMIL animations tend to have more solid browser support than Web Animations API

Albeit, it's neglectable due to the grateful retirement of internet explorer.

Body:
I am animating a svg element currently like following

.r1 {
     transform-box: fill-box;
     transform-origin: 50% 50%;
     animation-name: simpleRotation,xRotation;
     animation-delay: 0s, 2s;
     animation-duration: 2s;
     animation-iteration-count: 1, 1;
     animation-timing-function: linear;
     animation-direction: normal;
     animation-fill-mode: forwards;
}

@keyframes simpleRotation {
     from {
         transform: rotate(0deg);
    }
     to {
         transform: rotate(359deg);

    }
}
@keyframes xRotation {
     from {
         transform: rotateX(0deg);
    }
     to {
         transform: rotateX(359deg);
    }
}

<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">
<rect class="r1" id="r1" x="10" y="10" width="10" height="10" stroke="black" stroke-width="0.25" fill="orange"></rect>
    </svg>

Is it possible to queue the animations (with javascript) in a way so that every 2s the animation runs one after another in a loop such as simpleRotation(0-2s);xRotation(2-4s);simpleRotation(4-6s);xRotation(6-8s);simpleRotation(8-10s);.....

Body:
An alternative to ccprog's svg SMIL approach might be using the Web Animations API

The keyframe animation can be translated to an animation object like this

let ani1 = animEl.animate(
  [{
    transform: "rotate(0deg)"
  }, {
    transform: "rotate(359deg)"
  }], {
    delay: 500,
    duration: 1000,
    iterations: 1
  }
);

See also: MDN: Using the Web Animations API

Example

let animEl = document.querySelector(".rect1");

let ani1 = animEl.animate(
  [{
    transform: "rotate(0deg)"
  }, {
    transform: "rotate(359deg)"
  }], {
    delay: 500,
    duration: 1000,
    iterations: 1
  }
);

let ani2 = animEl.animate(
  [{
    transform: "rotateX(0deg)"
  }, {
    transform: "rotateX(359deg)"
  }], {
    delay: 500,
    duration: 1000,
    iterations: 1,
  }
);
// pause 2. animation
ani2.pause();

// chain animations
ani1.onfinish = function() {
  ani2.play();
};

ani2.onfinish = function() {
  ani1.play();
};

svg {
  border: 1px solid #ccc;
  display: block;
  width: 10em
}

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <rect class="rect1" id="r1" x="25" y="25" width="50" height="50" stroke="black" stroke-width="0.25" fill="orange" transform-origin="50 50" ></rect>
</svg>

We pause the second on start animation via

 ani2.pause();

and add an eventListener to start the second animation after the first one has finished.

ani1.onfinish = function() {
  ani2.play();
};

Edit you could also use premises as described by Dan Wilson

Don't miss out on the power of svg's SMIL animation

Especially when it comes to svg related animations, they still offer many bells and whistles not available in css animations like

Sequential animations:

<animate[...] begin="firstAnimation.end" />

The ability to start a consecutive animation (without any calculations of previous duration) via begin property is just awesome – this elegant concept should have been adopted to corresponding css animation methods.

Move elements along paths

self contained animations – like loading spinners
... svg wins!

Caniuse:

SMIL animations tend to have more solid browser support than Web Animations API

Albeit, it's neglectable due to the grateful retirement of internet explorer.


问:
Why should I use cell.render("Cell") instead of cell.value in react-table?
I'm using react-table package. I'm confused, what's the point of cell.render("Cell") when I can just write cell.value?
I see in my browser that it renders the same way. So, why should I use the first one?

答:
Because When you define the columns for your table you may want to customize how the Cell is rendered.
Here is an example of one of my columns.

```<code>{
        Header: "Enable",
        id: "enable",
        accessor: "enable",
        Cell: ({ value, row }) => (
            <FormCheck checked={value} onChange={(e) => handleCheckChange(row.index, e)} />
        ),
},
</code>```

I use the Cell property to customize how each cell will look on the table and I cant add props to the cell like onChange.
If I just used .value instead of .render(Cell) my cells would not have a  Element and I couldn't customize how the value is displayed within the Cell <FormCheck />

TLDR: If you want to customize the cells from your column definitions you will want to use the .render("Cell").
In my code example I use the Column option Cell to insert a CheckBox for that column (Does not effect the header () only ())

Body:
Because When you define the columns for your table you may want to customize how the Cell is rendered.
Here is an example of one of my columns.

{
        Header: "Enable",
        id: "enable",
        accessor: "enable",
        Cell: ({ value, row }) => (
            <FormCheck checked={value} onChange={(e) => handleCheckChange(row.index, e)} />
        ),
},

I use the Cell property to customize how each cell will look on the table and I cant add props to the cell like onChange.
If I just used .value instead of .render(Cell) my cells would not have a  Element and I couldn't customize how the value is displayed within the Cell <td><FormCheck /><td/>

TLDR: If you want to customize the cells from your column definitions you will want to use the .render("Cell").
In my code example I use the Column option Cell to insert a CheckBox for that column (Does not effect the header () only ())


问:
AS3 Error reporting from event callback
I have been experimenting with supplying better debugging information when an error happens in asynchronous code in AS3.

As an example of the poor error reporting be default, take the case where I force a null pointer in a Timer callback (github gist), I get the following stacktrace back on the console:

```<code>TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Function/<anonymous>()[/[path-to-source-file]/TestClass.as:14]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()
</code>```

This tells me very little about how the timer callback actually links to my code.

The question is: How can I get information about what code created the callback?

I have added one of my solutions below. I'm interested to see if this can be improved.

答:
You probably ask for a general solution. I would go with unit tests and proper debugging using  breakpoints and object inspection. But here another idea:

TestClass:

```<code>package {
    import flash.events.TimerEvent;
    import flash.utils.Timer;

    public class TestClass {
        public function TestClass(userCallback : Function, fail : Function) {
            var timer : Timer = new Timer(1000, 1);
            timer.addEventListener(TimerEvent.TIMER, internalCallback);
            timer.start();

            function internalCallback(e : TimerEvent):void {
                try {
                    var nullProperty : String;
                    nullProperty.length;
                } catch (e:Error) {
                    fail();
                    return;
                }
                userCallback();
            }
        }
    }
}
</code>```

Main:

```<code>package {
    import flash.display.Sprite;

    public class Main extends Sprite {
        public function Main() {
            new TestClass(
                function() : void { trace('Call me back when your done.'); },
                function() : void { throw new Error('Something went wrong.'); }
            );
        }
    }
}
</code>```

Output:

```<code>Exception fault: Error: Something went wrong.
    at Function/<anonymous>()[Main.as:8]
    at Function/TestClass/$construct/internalCallback()[TestClass.as:16]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()
</code>```

ContentLicense: CC BY-SA 3.0

Title: AS3 Error reporting from event callback

Body:
I have been experimenting with supplying better debugging information when an error happens in asynchronous code in AS3.

As an example of the poor error reporting be default, take the case where I force a null pointer in a Timer callback (github gist), I get the following stacktrace back on the console:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Function/<anonymous>()[/[path-to-source-file]/TestClass.as:14]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

This tells me very little about how the timer callback actually links to my code.

The question is: How can I get information about what code created the callback?

I have added one of my solutions below. I'm interested to see if this can be improved.

Body:
You probably ask for a general solution. I would go with unit tests and proper debugging using  breakpoints and object inspection. But here another idea:

TestClass:

package {
    import flash.events.TimerEvent;
    import flash.utils.Timer;

    public class TestClass {
        public function TestClass(userCallback : Function, fail : Function) {
            var timer : Timer = new Timer(1000, 1);
            timer.addEventListener(TimerEvent.TIMER, internalCallback);
            timer.start();

            function internalCallback(e : TimerEvent):void {
                try {
                    var nullProperty : String;
                    nullProperty.length;
                } catch (e:Error) {
                    fail();
                    return;
                }
                userCallback();
            }
        }
    }
}

Main:

package {
    import flash.display.Sprite;

    public class Main extends Sprite {
        public function Main() {
            new TestClass(
                function() : void { trace('Call me back when your done.'); },
                function() : void { throw new Error('Something went wrong.'); }
            );
        }
    }
}

Output:

Exception fault: Error: Something went wrong.
    at Function/<anonymous>()[Main.as:8]
    at Function/TestClass/$construct/internalCallback()[TestClass.as:16]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()


问:
Enabling font weight and colour in RESULTS block of org-babel
Is there any way to enable font weight and colours in the #+RESULTS block of org-babel?

For example, calling ls with the --color option renders font weights and colours as expected in the shell, but not when rendered within the #+RESULTS block:

```<code>#+BEGIN_SRC shell
ls --color ~/
#+END_SRC

#+RESULTS:
| Applications      |
| Desktop           |
| Documents         |
| Downloads         |
| Library           |
...
</code>```

Screenshot of ls with and without --color in the terminal

Another example is the node module chalk, which appears in the #+RESULTS block as plaintext:

```<code>#+BEGIN_SRC js
const chalk = require('chalk');

console.log(chalk.red('Hello world!'));
#+END_SRC

#+RESULTS:
: Hello world!
: undefined
</code>```

Screenshot of chalk in the terminal

答:
Here is what I came up with. Use it as an interactive function by running it while your cursor is on the code block (not the results block). You will need to have the xterm-color package installed.

```<code>(defun org-babel-color-results()
  "Color org babel results.
Use the :wrap header argument on your code block for best results.
Without it, org may color overtop with whatever default coloring it
uses for literal examples.
Depends on the xterm-color package."
  (interactive)
  (when-let ((result-start (org-babel-where-is-src-block-result nil nil)))
    (save-excursion
      (goto-char result-start)
      (when (looking-at org-babel-result-regexp)
        (let ((element (org-element-at-point)))
          (pcase (org-element-type element)
            (`fixed-width
             (let ((post-affiliated (org-element-property :post-affiliated element))
                   (end (org-element-property :end element))
                   (contents (org-element-property :value element))
                   (post-blank (org-element-property :post-blank element)))
               (goto-char post-affiliated)
               (delete-region post-affiliated end)
               (insert (xterm-color-filter contents))
               (org-babel-examplify-region post-affiliated (point))
               (insert (make-string post-blank ?\n ))
               ))
            ((or `center-block `quote-block `verse-block `special-block)
             (let ((contents-begin (org-element-property :contents-begin element))
                   (contents-end (org-element-property :contents-end element)))
               (goto-char contents-begin)
               (let ((contents (buffer-substring contents-begin contents-end)))
                 (delete-region contents-begin contents-end)
                 (insert (xterm-color-filter contents)))))))))))
</code>```

Or add a hook

```<code>(add-hook 'org-babel-after-execute-hook 'org-babel-color-results)
</code>```

This link was my inspiration.

One thing I haven't figured out is that although it colors the text when your not using the :wrap argument on your code block, the coloring for Org Literal Examples :  seems to override it. You can see the color is applied however by simply deleting the :  for a line expected to have color.

Body:
Is there any way to enable font weight and colours in the #+RESULTS block of org-babel?

For example, calling ls with the --color option renders font weights and colours as expected in the shell, but not when rendered within the #+RESULTS block:

#+BEGIN_SRC shell
ls --color ~/
#+END_SRC

#+RESULTS:
| Applications      |
| Desktop           |
| Documents         |
| Downloads         |
| Library           |
...

Screenshot of ls with and without --color in the terminal

Another example is the node module chalk, which appears in the #+RESULTS block as plaintext:

#+BEGIN_SRC js
const chalk = require('chalk');

console.log(chalk.red('Hello world!'));
#+END_SRC

#+RESULTS:
: Hello world!
: undefined

Screenshot of chalk in the terminal

Body:
Here is what I came up with. Use it as an interactive function by running it while your cursor is on the code block (not the results block). You will need to have the xterm-color package installed.

(defun org-babel-color-results()
  "Color org babel results.
Use the :wrap header argument on your code block for best results.
Without it, org may color overtop with whatever default coloring it
uses for literal examples.
Depends on the xterm-color package."
  (interactive)
  (when-let ((result-start (org-babel-where-is-src-block-result nil nil)))
    (save-excursion
      (goto-char result-start)
      (when (looking-at org-babel-result-regexp)
        (let ((element (org-element-at-point)))
          (pcase (org-element-type element)
            (`fixed-width
             (let ((post-affiliated (org-element-property :post-affiliated element))
                   (end (org-element-property :end element))
                   (contents (org-element-property :value element))
                   (post-blank (org-element-property :post-blank element)))
               (goto-char post-affiliated)
               (delete-region post-affiliated end)
               (insert (xterm-color-filter contents))
               (org-babel-examplify-region post-affiliated (point))
               (insert (make-string post-blank ?\n ))
               ))
            ((or `center-block `quote-block `verse-block `special-block)
             (let ((contents-begin (org-element-property :contents-begin element))
                   (contents-end (org-element-property :contents-end element)))
               (goto-char contents-begin)
               (let ((contents (buffer-substring contents-begin contents-end)))
                 (delete-region contents-begin contents-end)
                 (insert (xterm-color-filter contents)))))))))))

Or add a hook

(add-hook 'org-babel-after-execute-hook 'org-babel-color-results)

This link was my inspiration.

One thing I haven't figured out is that although it colors the text when your not using the :wrap argument on your code block, the coloring for Org Literal Examples :  seems to override it. You can see the color is applied however by simply deleting the :  for a line expected to have color.


问:
replacing integers in a data frame (logic issues)
So I am trying to change some values in a df using pandas and, having already tried with df.replace, df.mask, and df.where I got to the conclusion that it must be a logical mistake since it keeps throwing the same mistake:

```<code>ValueError: The truth value of a Series is ambiguous.
</code>```

I am trying to normalize a column in a dataset, thus the function and not just a single line. I need to understand why my logic is wrong, it seems to be such a dumb mistake.

This is my function:

```<code>def overweight_normalizer():
    if df[df["overweight"] > 25]:
        df.where(df["overweight"] > 25, 1)
    elif df[df["overweight"] < 25]:
        df.where(df["overweight"] < 25, 0)
</code>```

答:
df[df["overweight"] > 25] is not a valid condition.

Try this:

```<code>def overweight_normalizer():
    df = pd.DataFrame({'overweight': [2, 39, 15, 45, 9]})
    df["overweight"] = [1 if i > 25 else 0  for i in df["overweight"]]
    return df

overweight_normalizer()
</code>```

Output:

```<code>    overweight
0           0
1           1
2           0
3           1
4           0
</code>```

Body:
So I am trying to change some values in a df using pandas and, having already tried with df.replace, df.mask, and df.where I got to the conclusion that it must be a logical mistake since it keeps throwing the same mistake:

ValueError: The truth value of a Series is ambiguous.

I am trying to normalize a column in a dataset, thus the function and not just a single line. I need to understand why my logic is wrong, it seems to be such a dumb mistake.

This is my function:

def overweight_normalizer():
    if df[df["overweight"] > 25]:
        df.where(df["overweight"] > 25, 1)
    elif df[df["overweight"] < 25]:
        df.where(df["overweight"] < 25, 0)

Body:
df[df["overweight"] > 25] is not a valid condition.

Try this:

def overweight_normalizer():
    df = pd.DataFrame({'overweight': [2, 39, 15, 45, 9]})
    df["overweight"] = [1 if i > 25 else 0  for i in df["overweight"]]
    return df

overweight_normalizer()

Output:

    overweight
0           0
1           1
2           0
3           1
4           0


问:
Javascript Changing button inner text without chaning the icon
I created the following button, and want to change the inner text "test" to other word.

```<code>            <button type="button" id="test"><i class="fa-2x fa-regular fa-floppy-disk"></i>test</button>
</code>```

I tried below method it can change the word but also deleted the icon.

```<code>$('button#bkmarktest').on('click', function(e){
e.preventDefault();
$(this).text("other");
});
</code>```

Is there any way that can only change the word, but keeping the icon, thanks!

答:
What .text() method does is that it overwrites not only text but HTML as well. The easiest thing to do is move your text inside the  so it doesn't get overwitten only what's inside of it. Review the example below and notice that the icon remains -- it's because it's actually a CSS pseudo-element and is always ignored by methods and functions dealing with the DOM.

$('.test').on('click', function() {
  $(this).find('i').text(' IT WORKS!')
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link href='https://cdn.jsdelivr.net/fontawesome/4.7.0/css/font-awesome.min.css' rel='stylesheet'>

<button class='test' type='button'>
  <i class="fa fa-star-o"> TEST</i>
</button>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script></code>```

Body:
I created the following button, and want to change the inner text "test" to other word.

            <button type="button" id="test">test</button>

I tried below method it can change the word but also deleted the icon.

$('button#bkmarktest').on('click', function(e){
e.preventDefault();
$(this).text("other");
});

Is there any way that can only change the word, but keeping the icon, thanks!

Body:
What .text() method does is that it overwrites not only text but HTML as well. The easiest thing to do is move your text inside the <i> so it doesn't get overwitten only what's inside of it. Review the example below and notice that the icon remains -- it's because it's actually a CSS pseudo-element and is always ignored by methods and functions dealing with the DOM.

$('.test').on('click', function() {
  $(this).find('i').text(' IT WORKS!')
});

<link href='https://cdn.jsdelivr.net/fontawesome/4.7.0/css/font-awesome.min.css' rel='stylesheet'>

<button class='test' type='button'>
  <i class="fa fa-star-o"> TEST</i>
</button>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>


问:
Why update doesn't work with join based on returning values from insert on the same table
I am updating a table with data from another table from another database. Most columns can be moved with no change but some of them require mapping/change after import since they refer to the new database ids. My first attempt was to make insert with returning values and use those values in update on the same table, with additional joins. It does not work. Postgres inserts records and ignores updates, with no error. Simplified example of the case below.

```<code>Create table test(
    idtst serial ,
    name varchar(10),
    nameid varchar(20));

with tst as ( -- makes insert, no update
Insert into test(name,nameid) values ('tsta','tsta')
    returning idtst,nameid)
update test t
set nameid=t.nameid||t.idtst::varchar(5)
from tst i
where t.idtst=i.idtst;

with tst as ( -- makes insert, no update
Insert into test(name,nameid) values ('tstb','tstb')
    returning idtst,nameid)
update test t
set nameid=i.nameid||i.idtst::varchar(5)
from tst i
where t.idtst=i.idtst;

Create temp table tmp_tst(
    idtst integer,nameid varchar(20));

with tst as (
Insert into test(name,nameid) values ('tstc','tstc')
    returning idtst,nameid)
Insert into tmp_tst Select * from tst; -- insert into tmp
update test t -- makes update
set nameid=i.nameid||i.idtst::varchar(5)
from tmp_tst i
where t.idtst=i.idtst;
</code>```

Does it depend on postgres version/configuration ?
In test in result there are records

```<code>1,tsta,tsta
2,tstb,tstb
3,tstc,tstc3
</code>```

No errors, no warnings, just psql ignores first two updates. Updates/Inserts on any other table are OK.

答:
What is table i? Where does it come from?

My guess would be, that there is no lines which fullfill t.idtst=i.idtst

Maybe you should look at this:

```<code>SELECT *
FROM test as t, i
WHERE t.idtst=i.idtst
</code>```

Body:
I am updating a table with data from another table from another database. Most columns can be moved with no change but some of them require mapping/change after import since they refer to the new database ids. My first attempt was to make insert with returning values and use those values in update on the same table, with additional joins. It does not work. Postgres inserts records and ignores updates, with no error. Simplified example of the case below.

Create table test(
    idtst serial ,
    name varchar(10),
    nameid varchar(20));

with tst as ( -- makes insert, no update
Insert into test(name,nameid) values ('tsta','tsta')
    returning idtst,nameid)
update test t
set nameid=t.nameid||t.idtst::varchar(5)
from tst i
where t.idtst=i.idtst;

with tst as ( -- makes insert, no update
Insert into test(name,nameid) values ('tstb','tstb')
    returning idtst,nameid)
update test t
set nameid=i.nameid||i.idtst::varchar(5)
from tst i
where t.idtst=i.idtst;

Create temp table tmp_tst(
    idtst integer,nameid varchar(20));

with tst as (
Insert into test(name,nameid) values ('tstc','tstc')
    returning idtst,nameid)
Insert into tmp_tst Select * from tst; -- insert into tmp
update test t -- makes update
set nameid=i.nameid||i.idtst::varchar(5)
from tmp_tst i
where t.idtst=i.idtst;

Does it depend on postgres version/configuration ?
In test in result there are records

1,tsta,tsta
2,tstb,tstb
3,tstc,tstc3

No errors, no warnings, just psql ignores first two updates. Updates/Inserts on any other table are OK.

Body:
What is table i? Where does it come from?

My guess would be, that there is no lines which fullfill t.idtst=i.idtst

Maybe you should look at this:

SELECT *
FROM test as t, i
WHERE t.idtst=i.idtst


问:
refer to own class in python class method when subclassing
I'm wanting to keep a class attribute on a base class which keeps track of all names of all its subclasses.

class SomeThing(abc.ABC):
   subclass_names = set()
   def __init_subclass__(cls):
       cls.subclass_names.add(cls.__name__)
       print(cls.subclass_names)
```
<p>However, I'm afraid that because I'm creating an abstract class, users might overwrite the class attribute I am keeping.</p>
<pre class="lang-py prettyprint-override"><code>class SomeSub(SomeThing):
    subclass_names = set()

out: {'SomeSub'}

class SomeOtherSub(SomeThing):
    pass

out: {'SomeOtherThing'} # should be {'SomeSub', 'SomeOtherThing'}
# but SomeOtherThing is registered in SomeOtherThing's, not SomeThing's subclass_names

</code>```

Is there a way to refer to "own class" in a class method? It seems like the cls in __init_subclass__ ends up being whichever subclass is passed in (which makes sense).

答:
Take advantage of name mangling:

```<code>class SomeThing(abc.ABC):
   __subclass_names = set()
   def __init_subclass__(cls):
       cls.__subclass_names.add(cls.__name__)
       print(cls.__subclass_names)
</code>```

As the docs say:

Since there is a valid use-case for class-private members (namely to avoid name clashes of names with names defined by subclasses), there is limited support for such a mechanism, called name mangling. Any identifier of the form __spam (at least two leading underscores, at most one trailing underscore) is textually replaced with _classname__spam, where classname is the current class name with leading underscore(s) stripped.

This means that subclasses of SomeThing won't accidentally override __subclass_names, since they will actually have to override _SomeThing__subclass_names instead.

Body:
I'm wanting to keep a class attribute on a base class which keeps track of all names of all its subclasses.

class SomeThing(abc.ABC):
   subclass_names = set()
   def __init_subclass__(cls):
       cls.subclass_names.add(cls.__name__)
       print(cls.subclass_names)

However, I'm afraid that because I'm creating an abstract class, users might overwrite the class attribute I am keeping.

class SomeSub(SomeThing):
    subclass_names = set()

out: {'SomeSub'}

class SomeOtherSub(SomeThing):
    pass

out: {'SomeOtherThing'} # should be {'SomeSub', 'SomeOtherThing'}
# but SomeOtherThing is registered in SomeOtherThing's, not SomeThing's subclass_names

Is there a way to refer to "own class" in a class method? It seems like the cls in __init_subclass__ ends up being whichever subclass is passed in (which makes sense).

Body:
Take advantage of name mangling:

class SomeThing(abc.ABC):
   __subclass_names = set()
   def __init_subclass__(cls):
       cls.__subclass_names.add(cls.__name__)
       print(cls.__subclass_names)

As the docs say:

Since there is a valid use-case for class-private members (namely to avoid name clashes of names with names defined by subclasses), there is limited support for such a mechanism, called name mangling. Any identifier of the form __spam (at least two leading underscores, at most one trailing underscore) is textually replaced with _classname__spam, where classname is the current class name with leading underscore(s) stripped.

This means that subclasses of SomeThing won't accidentally override __subclass_names, since they will actually have to override _SomeThing__subclass_names instead.


问:
Is possible to use array values resulted from `string.match()` as options for a ts type?
 Hey,

I think it may be useful to start by providing all the packages:

```<code>    "@figma/plugin-typings": "^1.17.1",
    "@rollup/plugin-json": "^4.1.0",
    "@rollup/plugin-node-resolve": "^13.0.4",
    "@rollup/plugin-typescript": "^8.2.5",
    "prettier": "^2.3.2",
    "prettier-plugin-organize-imports": "^2.3.3",
    "rollup": "^2.32.0",
    "rollup-plugin-copy": "^3.4.0",
    "rollup-plugin-terser": "^7.0.2",
    "tslib": "^2.1.0",
    "typescript": "^4.2.4"
</code>```

I have a .json file which from which I want to extract certain information.

```<code>// file.json
{
   ...,
   {
      "name": "Copy Selection",
      "command": "copySelection"
    },
    {
      "name": "Paste In",
      "command": "pasteIn"
    },
    ...

}
</code>```

I'm trying to get all the commands from the file.json and use them as type options:

```<code>import manifest from '../manifest.json';

const regex = /(?<="command":")(.*?)(?=")/g;

const matches = JSON.stringify(manifest).match(regex);
const commands = [...matches] as const;

export type PluginCommands = typeof commands[number];
// results
// PluginCommands = string

// expected
// PluginCommands = "copySelection" | "PasteIn" | ...

const meh = ['ala', 'bala', 'portcolaa'] as const;

type mehType = typeof meh[number];
// mehType = "ala" | "bala" | "portcolaa"
</code>```

I want this because I want to get use of vscode intellisense and autocomplete, and ts warnings.

While writing this question, an idea stroke myself, to write a rollup plugin to get the matches into a file.

✅ My solution:

I used the rollup-plugin-copy to create a modified copy of the json file.

Then I'm using variable as source for my type.

Below is the code I used:

```<code>// rollup.config
     ...
     copy({
        targets: [{ src: './src/manifest.json', dest: './build' }],
        targets: [
          {
            src: './src/manifest.json',
            dest: './src/',
            rename: 'manifestCommands.ts',
            transform: (contents, filename) => {
              const content = contents.toString();

              const regex = /(?<="command": ")(.*?)(?=")/g;
              const matches = content.match(regex);

              const results = `export const manifestCommands = ${JSON.stringify(matches)} as const`;

              return results;
            },
          },
        ],
      })
      ...
</code>```
```<code>// another_file.ts
// import manifestCommands variable

type PluginCommands = typeof manifestCommands[number];
</code>```

答:
Importing a JSON file will give you it's structure as a type, but it won't ever give you anything more specific than a string, so this isn't possible. JSON imports just aren't typed that strongly.

Also, match will only ever return strings, so that's not possible either.

To pull this off you'd need to treat your object in that JSON like source code, and not data. Which means you make it a typescript file

```<code>// manifest.ts
const manifest = [
    {
        "name": "Copy Selection",
        "command": "copySelection"
    },
    {
        "name": "Paste In",
        "command": "pasteIn"
    },
] as const
</code>```

Then you can simply do:

```<code>type PluginCommands = typeof manifest[number]['command']
// "copySelection" | "pasteIn"
</code>```

Playground

But if your file must be JSON, then this isn't ever going to work.

Lastly, I wouldn't ever recommend regexing through a JSON string for anything. It's always going to better to parse that JSON string and then crawl through the resulting values.

Body:
 Hey,

I think it may be useful to start by providing all the packages:

    "@figma/plugin-typings": "^1.17.1",
    "@rollup/plugin-json": "^4.1.0",
    "@rollup/plugin-node-resolve": "^13.0.4",
    "@rollup/plugin-typescript": "^8.2.5",
    "prettier": "^2.3.2",
    "prettier-plugin-organize-imports": "^2.3.3",
    "rollup": "^2.32.0",
    "rollup-plugin-copy": "^3.4.0",
    "rollup-plugin-terser": "^7.0.2",
    "tslib": "^2.1.0",
    "typescript": "^4.2.4"

I have a .json file which from which I want to extract certain information.

// file.json
{
   ...,
   {
      "name": "Copy Selection",
      "command": "copySelection"
    },
    {
      "name": "Paste In",
      "command": "pasteIn"
    },
    ...

}

I'm trying to get all the commands from the file.json and use them as type options:

import manifest from '../manifest.json';

const regex = /(?<="command":")(.*?)(?=")/g;

const matches = JSON.stringify(manifest).match(regex);
const commands = [...matches] as const;

export type PluginCommands = typeof commands[number];
// results
// PluginCommands = string

// expected
// PluginCommands = "copySelection" | "PasteIn" | ...

const meh = ['ala', 'bala', 'portcolaa'] as const;

type mehType = typeof meh[number];
// mehType = "ala" | "bala" | "portcolaa"

I want this because I want to get use of vscode intellisense and autocomplete, and ts warnings.

While writing this question, an idea stroke myself, to write a rollup plugin to get the matches into a file.

✅ My solution:

I used the rollup-plugin-copy to create a modified copy of the json file.

Then I'm using variable as source for my type.

Below is the code I used:

// rollup.config
     ...
     copy({
        targets: [{ src: './src/manifest.json', dest: './build' }],
        targets: [
          {
            src: './src/manifest.json',
            dest: './src/',
            rename: 'manifestCommands.ts',
            transform: (contents, filename) => {
              const content = contents.toString();

              const regex = /(?<="command": ")(.*?)(?=")/g;
              const matches = content.match(regex);

              const results = `export const manifestCommands = ${JSON.stringify(matches)} as const`;

              return results;
            },
          },
        ],
      })
      ...

// another_file.ts
// import manifestCommands variable

type PluginCommands = typeof manifestCommands[number];

Body:
Importing a JSON file will give you it's structure as a type, but it won't ever give you anything more specific than a string, so this isn't possible. JSON imports just aren't typed that strongly.

Also, match will only ever return strings, so that's not possible either.

To pull this off you'd need to treat your object in that JSON like source code, and not data. Which means you make it a typescript file

// manifest.ts
const manifest = [
    {
        "name": "Copy Selection",
        "command": "copySelection"
    },
    {
        "name": "Paste In",
        "command": "pasteIn"
    },
] as const

Then you can simply do:

type PluginCommands = typeof manifest[number]['command']
// "copySelection" | "pasteIn"

Playground

But if your file must be JSON, then this isn't ever going to work.

Lastly, I wouldn't ever recommend regexing through a JSON string for anything. It's always going to better to parse that JSON string and then crawl through the resulting values.