问:
Editorconfig setting to allow object-initializer be aligned beneath the new-keyword
I'm using VisualStudio 2022 together with R# 2022.2.4.

Resharper is configured to apply alignment as shown in drawing below. (aligned with the new keyword)
The problem now is that the .editorconfigsettings used by our company come to complain about this due to the fact that we have the following in the editorconfig-file :

# Enforce formatting guidelines

dotnet_diagnostic.IDE0055.severity = error

(our C#-projects are also configured so that warnings are treated as errors, that's the reason why in the error-list I have 4 errors and not warnings)

Already went through the entire editorconfig file to see which setting is causing the error, but don't see anything wrong with it ?

Does anyone have an idea which settings I should change in editorconfig so that the error does not occur anymore ?

`

```<code># Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true

# C# files
[*.cs]

#### Core EditorConfig Options ####

# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4

# New line preferences
end_of_line = unset
insert_final_newline = true

#### .NET Coding Conventions ####

# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
file_header_template = unset

# this. and Me. preferences
dotnet_style_qualification_for_event = false:error
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_property = false:error

# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:error

# Expression-level preferences
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion

# Field preferences
dotnet_style_readonly_field = true:suggestion

# Parameter preferences
dotnet_code_quality_unused_parameters = all:suggestion

# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none

#### C# Coding Conventions ####

# var preferences
csharp_style_var_elsewhere = false:suggestion
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion

# Expression-bodied members
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent

# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_switch_expression = true:suggestion

# Null-checking preferences
csharp_style_conditional_delegate_call = true:suggestion

# Modifier preferences
csharp_prefer_static_local_function = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error

# Code-block preferences
csharp_prefer_braces =false:silent
csharp_prefer_simple_using_statement = true:suggestion

# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:error

#### C# Formatting Rules ####

# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = no_change
csharp_indent_switch_labels = true

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false

#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_naming.severity = error
dotnet_naming_rule.interface_naming.symbols = interface
dotnet_naming_rule.interface_naming.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = error
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.private_or_internal_field_should_be__camelcase.severity = error
dotnet_naming_rule.private_or_internal_field_should_be__camelcase.symbols = private_or_internal_field
dotnet_naming_rule.private_or_internal_field_should_be__camelcase.style = _camelcase

dotnet_naming_rule.non_public_field_should_be_pascalcase.severity = error
dotnet_naming_rule.non_public_field_should_be_pascalcase.symbols = non_public_field
dotnet_naming_rule.non_public_field_should_be_pascalcase.style = pascal_case

dotnet_naming_rule.const_field_should_be_pascalcase.severity = error
dotnet_naming_rule.const_field_should_be_pascalcase.symbols = const_field
dotnet_naming_rule.const_field_should_be_pascalcase.style = pascal_case

dotnet_naming_rule.static_readonly_field_should_be_pascalcase.severity = error
dotnet_naming_rule.static_readonly_field_should_be_pascalcase.symbols = static_readonly_field
dotnet_naming_rule.static_readonly_field_should_be_pascalcase.style = pascal_case

dotnet_naming_rule.parameters_should_be_camelcase.severity = error
dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
dotnet_naming_rule.parameters_should_be_camelcase.style = camel_case

dotnet_naming_rule.locals_should_be_camelcase.severity = error
dotnet_naming_rule.locals_should_be_camelcase.symbols = locals
dotnet_naming_rule.locals_should_be_camelcase.style = camel_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.required_modifiers =

dotnet_naming_symbols.non_public_field.applicable_kinds = field
dotnet_naming_symbols.non_public_field.applicable_accessibilities = protected, protected_internal, public
dotnet_naming_symbols.non_public_field.required_modifiers =

dotnet_naming_symbols.const_field.applicable_kinds = field
dotnet_naming_symbols.const_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.const_field.required_modifiers = const

dotnet_naming_symbols.static_readonly_field.applicable_kinds = field
dotnet_naming_symbols.static_readonly_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_readonly_field.required_modifiers = static, readonly

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

dotnet_naming_symbols.parameters.applicable_kinds = parameter
dotnet_naming_symbols.parameters.applicable_accessibilities = *
dotnet_naming_symbols.parameters.required_modifiers =

dotnet_naming_symbols.locals.applicable_kinds = local
dotnet_naming_symbols.locals.applicable_accessibilities = *
dotnet_naming_symbols.locals.required_modifiers =

# Naming styles

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style._camelcase.required_prefix = _
dotnet_naming_style._camelcase.required_suffix =
dotnet_naming_style._camelcase.word_separator =
dotnet_naming_style._camelcase.capitalization = camel_case

dotnet_naming_style.camel_case.required_prefix =
dotnet_naming_style.camel_case.required_suffix =
dotnet_naming_style.camel_case.word_separator =
dotnet_naming_style.camel_case.capitalization = camel_case

#### dotnet diagnostics ####
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/

# Remove 'this' qualification (not yet supported on build)
dotnet_diagnostic.IDE0003.severity = error

# Naming styles
dotnet_diagnostic.IDE1006.severity = error

# IDE0036: Order modifiers
dotnet_diagnostic.IDE0036.severity = error

# IDE0040: Add accessibility modifiers
dotnet_diagnostic.IDE0040.severity = error

# IDE0043: Invalid format string
dotnet_diagnostic.IDE0043.severity = error

# Use language keywords instead of framework type names for type references (not yet supported on build)
dotnet_diagnostic.IDE0049.severity = error

##### code quality ####

# CA1001: Types that own disposable fields should be disposable
dotnet_diagnostic.CA1001.severity = error

# CA1032: Implement standard exception constructors
dotnet_diagnostic.CA1032.severity = error

# CA1065: Do not raise exceptions in unexpected locations
dotnet_diagnostic.CA1065.severity = error

# CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1707.severity = error

# CA1727: Use PascalCase for named placeholders
dotnet_diagnostic.CA1727.severity = error

# Enforce formatting guidelines
dotnet_diagnostic.IDE0055.severity = error

# Raise error if Tasks aren't awaited, even if calling method is not marked async
dotnet_diagnostic.LindhartAnalyserMissingAwaitWarning.severity=error

# Do not complain about version number not being Major.Minor.Build.Revision (we use semver, which does not include revision)
dotnet_diagnostic.CS7035.severity = none

# Avoid awaiting return a Task representing work that was not started within your context...
dotnet_diagnostic.VSTHRD003.severity = none

# AsyncLazy
dotnet_diagnostic.VSTHRD011.severity = none

# Use explicit task scheduler.
dotnet_diagnostic.VSTHRD105.severity = none

# Don't force async methods to end with Async
dotnet_diagnostic.VSTHRD200.severity = none

##### exceptions to the rules ####

# C# files in a "Contracts" project
[**.Contracts/*.cs]

# Overrides the rule that interfaces should start with 'I' because message interfaces do not need to.
dotnet_naming_rule.interface_naming.style = pascal_case

# C# files in a "Test" project
[**{Test.cs,Tests.cs}]

# CA1707: Identifiers should not contain underscores
# Test names can contain underscores for readability
dotnet_diagnostic.CA1707.severity = silent
</code>```

`

Body:
I'm using VisualStudio 2022 together with R# 2022.2.4.

Resharper is configured to apply alignment as shown in drawing below. (aligned with the new keyword)
The problem now is that the .editorconfigsettings used by our company come to complain about this due to the fact that we have the following in the editorconfig-file :

# Enforce formatting guidelines

dotnet_diagnostic.IDE0055.severity = error

(our C#-projects are also configured so that warnings are treated as errors, that's the reason why in the error-list I have 4 errors and not warnings)

Already went through the entire editorconfig file to see which setting is causing the error, but don't see anything wrong with it ?

Does anyone have an idea which settings I should change in editorconfig so that the error does not occur anymore ?

`

# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true

# C# files
[*.cs]

#### Core EditorConfig Options ####

# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4

# New line preferences
end_of_line = unset
insert_final_newline = true

#### .NET Coding Conventions ####

# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
file_header_template = unset

# this. and Me. preferences
dotnet_style_qualification_for_event = false:error
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_property = false:error

# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:error

# Expression-level preferences
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion

# Field preferences
dotnet_style_readonly_field = true:suggestion

# Parameter preferences
dotnet_code_quality_unused_parameters = all:suggestion

# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none

#### C# Coding Conventions ####

# var preferences
csharp_style_var_elsewhere = false:suggestion
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion

# Expression-bodied members
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent

# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_switch_expression = true:suggestion

# Null-checking preferences
csharp_style_conditional_delegate_call = true:suggestion

# Modifier preferences
csharp_prefer_static_local_function = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error

# Code-block preferences
csharp_prefer_braces =false:silent
csharp_prefer_simple_using_statement = true:suggestion

# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:error

#### C# Formatting Rules ####

# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = no_change
csharp_indent_switch_labels = true

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false

#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_naming.severity = error
dotnet_naming_rule.interface_naming.symbols = interface
dotnet_naming_rule.interface_naming.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = error
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.private_or_internal_field_should_be__camelcase.severity = error
dotnet_naming_rule.private_or_internal_field_should_be__camelcase.symbols = private_or_internal_field
dotnet_naming_rule.private_or_internal_field_should_be__camelcase.style = _camelcase

dotnet_naming_rule.non_public_field_should_be_pascalcase.severity = error
dotnet_naming_rule.non_public_field_should_be_pascalcase.symbols = non_public_field
dotnet_naming_rule.non_public_field_should_be_pascalcase.style = pascal_case

dotnet_naming_rule.const_field_should_be_pascalcase.severity = error
dotnet_naming_rule.const_field_should_be_pascalcase.symbols = const_field
dotnet_naming_rule.const_field_should_be_pascalcase.style = pascal_case

dotnet_naming_rule.static_readonly_field_should_be_pascalcase.severity = error
dotnet_naming_rule.static_readonly_field_should_be_pascalcase.symbols = static_readonly_field
dotnet_naming_rule.static_readonly_field_should_be_pascalcase.style = pascal_case

dotnet_naming_rule.parameters_should_be_camelcase.severity = error
dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
dotnet_naming_rule.parameters_should_be_camelcase.style = camel_case

dotnet_naming_rule.locals_should_be_camelcase.severity = error
dotnet_naming_rule.locals_should_be_camelcase.symbols = locals
dotnet_naming_rule.locals_should_be_camelcase.style = camel_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.required_modifiers =

dotnet_naming_symbols.non_public_field.applicable_kinds = field
dotnet_naming_symbols.non_public_field.applicable_accessibilities = protected, protected_internal, public
dotnet_naming_symbols.non_public_field.required_modifiers =

dotnet_naming_symbols.const_field.applicable_kinds = field
dotnet_naming_symbols.const_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.const_field.required_modifiers = const

dotnet_naming_symbols.static_readonly_field.applicable_kinds = field
dotnet_naming_symbols.static_readonly_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_readonly_field.required_modifiers = static, readonly

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

dotnet_naming_symbols.parameters.applicable_kinds = parameter
dotnet_naming_symbols.parameters.applicable_accessibilities = *
dotnet_naming_symbols.parameters.required_modifiers =

dotnet_naming_symbols.locals.applicable_kinds = local
dotnet_naming_symbols.locals.applicable_accessibilities = *
dotnet_naming_symbols.locals.required_modifiers =

# Naming styles

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style._camelcase.required_prefix = _
dotnet_naming_style._camelcase.required_suffix =
dotnet_naming_style._camelcase.word_separator =
dotnet_naming_style._camelcase.capitalization = camel_case

dotnet_naming_style.camel_case.required_prefix =
dotnet_naming_style.camel_case.required_suffix =
dotnet_naming_style.camel_case.word_separator =
dotnet_naming_style.camel_case.capitalization = camel_case

#### dotnet diagnostics ####
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/

# Remove 'this' qualification (not yet supported on build)
dotnet_diagnostic.IDE0003.severity = error

# Naming styles
dotnet_diagnostic.IDE1006.severity = error

# IDE0036: Order modifiers
dotnet_diagnostic.IDE0036.severity = error

# IDE0040: Add accessibility modifiers
dotnet_diagnostic.IDE0040.severity = error

# IDE0043: Invalid format string
dotnet_diagnostic.IDE0043.severity = error

# Use language keywords instead of framework type names for type references (not yet supported on build)
dotnet_diagnostic.IDE0049.severity = error

##### code quality ####

# CA1001: Types that own disposable fields should be disposable
dotnet_diagnostic.CA1001.severity = error

# CA1032: Implement standard exception constructors
dotnet_diagnostic.CA1032.severity = error

# CA1065: Do not raise exceptions in unexpected locations
dotnet_diagnostic.CA1065.severity = error

# CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1707.severity = error

# CA1727: Use PascalCase for named placeholders
dotnet_diagnostic.CA1727.severity = error

# Enforce formatting guidelines
dotnet_diagnostic.IDE0055.severity = error

# Raise error if Tasks aren't awaited, even if calling method is not marked async
dotnet_diagnostic.LindhartAnalyserMissingAwaitWarning.severity=error

# Do not complain about version number not being Major.Minor.Build.Revision (we use semver, which does not include revision)
dotnet_diagnostic.CS7035.severity = none

# Avoid awaiting return a Task representing work that was not started within your context...
dotnet_diagnostic.VSTHRD003.severity = none

# AsyncLazy
dotnet_diagnostic.VSTHRD011.severity = none

# Use explicit task scheduler.
dotnet_diagnostic.VSTHRD105.severity = none

# Don't force async methods to end with Async
dotnet_diagnostic.VSTHRD200.severity = none

##### exceptions to the rules ####

# C# files in a "Contracts" project
[**.Contracts/*.cs]

# Overrides the rule that interfaces should start with 'I' because message interfaces do not need to.
dotnet_naming_rule.interface_naming.style = pascal_case

# C# files in a "Test" project
[**{Test.cs,Tests.cs}]

# CA1707: Identifiers should not contain underscores
# Test names can contain underscores for readability
dotnet_diagnostic.CA1707.severity = silent

`


来源: stackexchange

问:
My Solidity program work on Ganache but not on testnet (Goerli)
I want to get all reserve in UniswapV2 pool in one request to the EVM. Here is the code getReserve :

```<code>// SPDX-License-Identifier: MIT
// compiled with 0.8.17
pragma solidity >=0.4.22 <0.9.0;

contract IUniswapV2Pair {
  function getReserves() public view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) {}
}

contract getReserve {
  function get(address[] memory _add) external view returns (uint[] memory) {
    uint n = _add.length;
    uint[] memory liste = new uint[](n*2);

    // Define variables to store the returned values
    uint112 reserve0;
    uint112 reserve1;
    uint32 blockTimestampLast;
    for (uint i=0; i<n; i++) {
      // Call the getReserves function in the other contract and store the returned values
      (reserve0, reserve1, blockTimestampLast) = IUniswapV2Pair(_add[i]).getReserves();
      liste[i*2] = reserve0;
      liste[i*2+1] = reserve1;
    }

    return liste;
  }

  function getOnlyOne(address _add) external view returns (uint112, uint112, uint32) {
    return IUniswapV2Pair(_add).getReserves();
  }
}

</code>```

To test that this program work well on my Ganache EVM I have created this program IUniswapV2Pair:

```<code>// SPDX-License-Identifier: MIT
// compiled with 0.8.17
pragma solidity >=0.4.22 <0.9.0;

contract IUniswapV2Pair {
  function getReserves() external pure returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) {
    reserve0 = 11;
    reserve1 = 12;
    blockTimestampLast = 13;
    return (reserve0, reserve1, blockTimestampLast);
  }

}

</code>```

Like I said, it is working well on my Ganache EVM. But when I deploy it on the GOERLI testnet it is not working, here is the addresss :

getReserve : 0x993305D7d90675656857c7Cd69f1CF57242D79D5

IUniswapV2Pair : 0x33e57A530F90aB2A5572E2a877161Ca644e8FC95

My Problem is to make getOnlyOne("0x33e57A530F90aB2A5572E2a877161Ca644e8FC95") working.

1 Testing code on Goerli

I have tried to connect to GOERLI via Python, here is the code :

from web3 import Web3
import json, web3

server = "https://eth-goerli.public.blastapi.io"

w3 = Web3(Web3.HTTPProvider(server))
w3.isConnected()

# Contrat intermédiaire
address = "0x993305D7d90675656857c7Cd69f1CF57242D79D5"
abi = [{"inputs":[{"internalType":"address[]","name":"_add","type":"address[]"}],"name":"get","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"address","name":"_add","type":"address"}],"name":"getOnlyOne","outputs":[{"internalType":"uint112","name":"","type":"uint112"},{"internalType":"uint112","name":"","type":"uint112"},{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function","constant":true}]

contract = w3.eth.contract(address=address, abi=abi)

contract.all_functions()
contract.functions.get(["0x33e57A530F90aB2A5572E2a877161Ca644e8FC95"]).call()
contract.functions.getOnlyOne("0x33e57A530F90aB2A5572E2a877161Ca644e8FC95").call()
```
<p>I have this error <strong>web3.exceptions.ContractLogicError: execution reverted</strong>, which I don't have when I do it on Ganache.
And to make sure that it is not a problem from IUniswapV2Pair I have this code:</p>
<pre class="lang-py prettyprint-override"><code>address = "0x33e57A530F90aB2A5572E2a877161Ca644e8FC95"
abi = [{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"reserve0","type":"uint112"},{"internalType":"uint112","name":"reserve1","type":"uint112"},{"internalType":"uint32","name":"blockTimestampLast","type":"uint32"}],"stateMutability":"pure","type":"function","constant":true}]

contract = w3.eth.contract(address=address, abi=abi)

contract.all_functions()
contract.functions.getReserves().call()
</code>```

Which return me : [11, 12, 13]

2 Testing connection between contracts

I have created 2 others easier smart contract which have been working well here it is :

```<code>// SPDX-License-Identifier: MIT
// compiled with 0.8.17
pragma solidity >=0.4.22 <0.9.0;

contract FavoriteNumber {
  uint favoriteNumber;
  function getFavoriteNumber() external view returns(uint) {
    return favoriteNumber;
  }

  function setFavoriteNumber(uint _favoriteNumber) external {
    favoriteNumber = _favoriteNumber;
  }
}

</code>```
```<code>// SPDX-License-Identifier: MIT
// compiled with 0.8.17
pragma solidity >=0.4.22 <0.9.0;

contract FavoriteNumber {
    function getFavoriteNumber() public view returns(uint) {}
    function setFavoriteNumber(uint _favoriteNumber) public {}
}

contract ExistingNoSet {

    function getA(address _t) public view returns (uint result) {
        return FavoriteNumber(_t).getFavoriteNumber();
    }

    function setA(address _t, uint _val) public {
        FavoriteNumber(_t).setFavoriteNumber(_val);
    }
}

</code>```

Here is the address :

FavoriteNumber : 0x14c89b4F462C11961Bb48aD6B2008f64617CF62a

ExistingNoSet : 0x97BdDaff1a971580f99C1DB850dE5EcF4982251a

And to test the code, here is the Python program, be careful I give a private key here (don't use it outside of a testnet) :

from web3 import Web3
import json, web3

server = "https://eth-goerli.public.blastapi.io"
private_key = "df49b58fbc863c5e60fe4e64829a853c46a8a12c3310404bc2a03bfefb89f68a"
public_add = "0xb4311ad11530F735ecE2d652Cbd56D1FB8D6Efeb"

w3 = Web3(Web3.HTTPProvider(server))
w3.isConnected()

# Contrat intermédiaire
address = "0x97BdDaff1a971580f99C1DB850dE5EcF4982251a"
abi = [{"inputs":[{"internalType":"address","name":"_t","type":"address"}],"name":"getA","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"address","name":"_t","type":"address"},{"internalType":"uint256","name":"_val","type":"uint256"}],"name":"setA","outputs":[],"stateMutability":"nonpayable","type":"function"}]

contract = w3.eth.contract(address=address, abi=abi)

contract.all_functions()
contract.functions.getA("0x14c89b4F462C11961Bb48aD6B2008f64617CF62a").call() # It should return 15

txn = contract.functions.setA(
    "0x14c89b4F462C11961Bb48aD6B2008f64617CF62a", 3 # You set this new number
).build_transaction({
    'nonce': w3.eth.get_transaction_count(public_add),
    'gas': 200000,
    'gasPrice': w3.toWei('20', 'gwei')
})
signed_txn = w3.eth.account.sign_transaction(txn, private_key=private_key)
w3.eth.send_raw_transaction(signed_txn.rawTransaction)

# You have to time sleep a little bit like 1min
contract.functions.getA("0x14c89b4F462C11961Bb48aD6B2008f64617CF62a").call() # It should return 3

```

So this program works well.

Thank you very to have read my post until here, I hope you will be able to help me.

ContentLicense: CC BY-SA 4.0

Body:
I want to get all reserve in UniswapV2 pool in one request to the EVM. Here is the code getReserve :

// SPDX-License-Identifier: MIT
// compiled with 0.8.17
pragma solidity >=0.4.22 <0.9.0;

contract IUniswapV2Pair {
  function getReserves() public view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) {}
}

contract getReserve {
  function get(address[] memory _add) external view returns (uint[] memory) {
    uint n = _add.length;
    uint[] memory liste = new uint[](n*2);

    // Define variables to store the returned values
    uint112 reserve0;
    uint112 reserve1;
    uint32 blockTimestampLast;
    for (uint i=0; i<n; i++) {
      // Call the getReserves function in the other contract and store the returned values
      (reserve0, reserve1, blockTimestampLast) = IUniswapV2Pair(_add[i]).getReserves();
      liste[i*2] = reserve0;
      liste[i*2+1] = reserve1;
    }

    return liste;
  }

  function getOnlyOne(address _add) external view returns (uint112, uint112, uint32) {
    return IUniswapV2Pair(_add).getReserves();
  }
}

To test that this program work well on my Ganache EVM I have created this program IUniswapV2Pair:

// SPDX-License-Identifier: MIT
// compiled with 0.8.17
pragma solidity >=0.4.22 <0.9.0;

contract IUniswapV2Pair {
  function getReserves() external pure returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) {
    reserve0 = 11;
    reserve1 = 12;
    blockTimestampLast = 13;
    return (reserve0, reserve1, blockTimestampLast);
  }

}

Like I said, it is working well on my Ganache EVM. But when I deploy it on the GOERLI testnet it is not working, here is the addresss :

getReserve : 0x993305D7d90675656857c7Cd69f1CF57242D79D5

IUniswapV2Pair : 0x33e57A530F90aB2A5572E2a877161Ca644e8FC95

My Problem is to make getOnlyOne("0x33e57A530F90aB2A5572E2a877161Ca644e8FC95") working.

1 Testing code on Goerli

I have tried to connect to GOERLI via Python, here is the code :

from web3 import Web3
import json, web3

server = "https://eth-goerli.public.blastapi.io"

w3 = Web3(Web3.HTTPProvider(server))
w3.isConnected()

# Contrat intermédiaire
address = "0x993305D7d90675656857c7Cd69f1CF57242D79D5"
abi = [{"inputs":[{"internalType":"address[]","name":"_add","type":"address[]"}],"name":"get","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"address","name":"_add","type":"address"}],"name":"getOnlyOne","outputs":[{"internalType":"uint112","name":"","type":"uint112"},{"internalType":"uint112","name":"","type":"uint112"},{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function","constant":true}]

contract = w3.eth.contract(address=address, abi=abi)

contract.all_functions()
contract.functions.get(["0x33e57A530F90aB2A5572E2a877161Ca644e8FC95"]).call()
contract.functions.getOnlyOne("0x33e57A530F90aB2A5572E2a877161Ca644e8FC95").call()

I have this error web3.exceptions.ContractLogicError: execution reverted, which I don't have when I do it on Ganache.
And to make sure that it is not a problem from IUniswapV2Pair I have this code:

address = "0x33e57A530F90aB2A5572E2a877161Ca644e8FC95"
abi = [{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"reserve0","type":"uint112"},{"internalType":"uint112","name":"reserve1","type":"uint112"},{"internalType":"uint32","name":"blockTimestampLast","type":"uint32"}],"stateMutability":"pure","type":"function","constant":true}]

contract = w3.eth.contract(address=address, abi=abi)

contract.all_functions()
contract.functions.getReserves().call()

Which return me : [11, 12, 13]

2 Testing connection between contracts

I have created 2 others easier smart contract which have been working well here it is :

// SPDX-License-Identifier: MIT
// compiled with 0.8.17
pragma solidity >=0.4.22 <0.9.0;

contract FavoriteNumber {
  uint favoriteNumber;
  function getFavoriteNumber() external view returns(uint) {
    return favoriteNumber;
  }

  function setFavoriteNumber(uint _favoriteNumber) external {
    favoriteNumber = _favoriteNumber;
  }
}

// SPDX-License-Identifier: MIT
// compiled with 0.8.17
pragma solidity >=0.4.22 <0.9.0;

contract FavoriteNumber {
    function getFavoriteNumber() public view returns(uint) {}
    function setFavoriteNumber(uint _favoriteNumber) public {}
}

contract ExistingNoSet {

    function getA(address _t) public view returns (uint result) {
        return FavoriteNumber(_t).getFavoriteNumber();
    }

    function setA(address _t, uint _val) public {
        FavoriteNumber(_t).setFavoriteNumber(_val);
    }
}

Here is the address :

FavoriteNumber : 0x14c89b4F462C11961Bb48aD6B2008f64617CF62a

ExistingNoSet : 0x97BdDaff1a971580f99C1DB850dE5EcF4982251a

And to test the code, here is the Python program, be careful I give a private key here (don't use it outside of a testnet) :

from web3 import Web3
import json, web3

server = "https://eth-goerli.public.blastapi.io"
private_key = "df49b58fbc863c5e60fe4e64829a853c46a8a12c3310404bc2a03bfefb89f68a"
public_add = "0xb4311ad11530F735ecE2d652Cbd56D1FB8D6Efeb"

w3 = Web3(Web3.HTTPProvider(server))
w3.isConnected()

# Contrat intermédiaire
address = "0x97BdDaff1a971580f99C1DB850dE5EcF4982251a"
abi = [{"inputs":[{"internalType":"address","name":"_t","type":"address"}],"name":"getA","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"address","name":"_t","type":"address"},{"internalType":"uint256","name":"_val","type":"uint256"}],"name":"setA","outputs":[],"stateMutability":"nonpayable","type":"function"}]

contract = w3.eth.contract(address=address, abi=abi)

contract.all_functions()
contract.functions.getA("0x14c89b4F462C11961Bb48aD6B2008f64617CF62a").call() # It should return 15

txn = contract.functions.setA(
    "0x14c89b4F462C11961Bb48aD6B2008f64617CF62a", 3 # You set this new number
).build_transaction({
    'nonce': w3.eth.get_transaction_count(public_add),
    'gas': 200000,
    'gasPrice': w3.toWei('20', 'gwei')
})
signed_txn = w3.eth.account.sign_transaction(txn, private_key=private_key)
w3.eth.send_raw_transaction(signed_txn.rawTransaction)

# You have to time sleep a little bit like 1min
contract.functions.getA("0x14c89b4F462C11961Bb48aD6B2008f64617CF62a").call() # It should return 3

So this program works well.

Thank you very to have read my post until here, I hope you will be able to help me.


问:
Why are the DotNet commands not found after successful installation and setup?
I have been trying to get Nuke to work for some time now, but am failing.

I installed the GlobalTools as follows:

```<code>dotnet tool install Nuke.GlobalTool --global
</code>```

And then ran the setup in the solution directory:

```<code>nuke :setup
</code>```

So far, so good. When I run nuke, everything works.

But now I want to fill the targets, e.g. the Restore Target with "DotNetRestore":

```<code>private Target Restore => _ => _
    .Executes(() =>
    {
        DotNetRestore(_ => _.SetProjectFile(Solution));
    });
</code>```

The issue is, Visual Studio underlines "DotNetRestore" red to me, with the message

The name 'DotNetRestore' does not exist in the current context

Also, when I run "nuke", the following error message appears:

C:\Users\domin\source\repos\ConsoleApp4\build\Build.cs(29,13): error CS0103: The name 'DotNetRestore' does not exist in the current context [C:\Users\domin\source\repos\ConsoleApp4\build_build.csproj].

Can anyone tell me what I am doing wrong or what I am missing? I have tested it with a solution in which projects with .NET 6 are present, as well as with a completely new solution, console program with .NET Framework 4.8.

Update:

OS I'm trying to run it: Windows 10 and Windows 11, if that matters

Body:
I have been trying to get Nuke to work for some time now, but am failing.

I installed the GlobalTools as follows:

dotnet tool install Nuke.GlobalTool --global

And then ran the setup in the solution directory:

nuke :setup

So far, so good. When I run nuke, everything works.

But now I want to fill the targets, e.g. the Restore Target with "DotNetRestore":

private Target Restore => _ => _
    .Executes(() =>
    {
        DotNetRestore(_ => _.SetProjectFile(Solution));
    });

The issue is, Visual Studio underlines "DotNetRestore" red to me, with the message

The name 'DotNetRestore' does not exist in the current context

Also, when I run "nuke", the following error message appears:

C:\Users\domin\source\repos\ConsoleApp4\build\Build.cs(29,13): error CS0103: The name 'DotNetRestore' does not exist in the current context [C:\Users\domin\source\repos\ConsoleApp4\build_build.csproj].

Can anyone tell me what I am doing wrong or what I am missing? I have tested it with a solution in which projects with .NET 6 are present, as well as with a completely new solution, console program with .NET Framework 4.8.

Update:

OS I'm trying to run it: Windows 10 and Windows 11, if that matters


问:
I'm getting some strange errors in my python code
I am making a chess board in python using pygame and since I am relatively new to python and my friend wrote some code we both don't understand we are dumbfounded trying to debug this program.

Here is my error

```<code>Traceback (most recent call last):
  File "/home/travisfiorito/Documents/Doggy rewrite/OtherProject/Play-Around/ChessAI/AI.py", line 99, in <module>
    draw_board()
  File "/home/travisfiorito/Documents/Doggy rewrite/OtherProject/Play-Around/ChessAI/AI.py", line 83, in draw_board
    screen.blit(image, (j * square_size, i * square_size))
UnboundLocalError: local variable 'image' referenced before assignment
</code>```

Here is my code

```<code>import sys
import os
import subprocess
import pygame
from PIL import Image
def install(package):
    subprocess.check_call([sys.executable, "-m", "pip", "install", package])

install("pygame")
pygame.init()
os.environ['SDL_AUDIODRIVER'] = 'dsp'
#os.environ["SDL_VIDEODRIVER"] = 'dummy'

image_filenames = ['/path/to/img/black_bishop.png', '/path/to/img/black_king.png', '/path/to/img/black_knight.png', '/path/to/img/black_pawn.png','/path/to/img/black_queen.png','/path/to/img/black_rook.png','/path/to/img/white_bishop.png', '/path/to/img/white_king.png', '/path/to/img/white_knight.png', '/path/to/img/white_pawn.png', '/path/to/img/white_queen.png', '/path/to/img/white_rook.png']
images = {}

window_size = 400
square_size = window_size // 8

pygame.display.set_caption('Scuffed Chess ai')
icon = pygame.Surface((1, 1))
icon.set_alpha(0)
pygame.display.set_icon(icon)
screen = pygame.display.set_mode((window_size, window_size))
screen.fill((255, 255, 255))

global board
board = [
    ['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'],
    ['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'],
    [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
    [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
    [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
    [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
    ['P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'],
    ['R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R']
]

selected_piece = None
selected_pos = None
selected_pos = []
images = {filename: pygame.image.load(filename) for filename in image_filenames}
image = None
def draw_board():
    for i in range(8):  # iterate from 0 to 7
        for j in range(8):  # iterate from 0 to 7
            color = (255, 255, 255) if (i + j) % 2 == 0 else (0, 0, 0)
            pygame.draw.rect(screen, color, (i * square_size, j * square_size, square_size, square_size))
    for i in range(8):  # iterate from 0 to 7
        for j in range(8):  # iterate from 0 to 7
            piece = board[i][j]
            if piece != ' ':
                if piece.islower():
                    color = (255, 255, 255)
                else:
                    color = (0, 0, 0)
                if piece == 'p':
                    image = images['black_pawn']
                elif piece == 'r':
                    image = images['black_rook']
                elif piece == 'n':
                    image = images['black_knight']
                elif piece == 'b':
                    image = images['black_bishop']
                elif piece == 'q':
                    image = images['black_queen']
                elif piece == 'k':
                    image = images['black_king']
                elif piece == 'P':
                    image = images['white_pawn']
                elif piece == 'R':
                    image = images['white_rook']
                elif piece == 'N':
                    image = images['white_knight']
                elif piece == 'B':
                    image = images['white_bishop']
                elif piece == 'Q':
                    image = images['white_queen']
                elif piece == 'K':
                    image = images['white_king']
                screen.blit(image, (j * square_size, i * square_size))

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        elif event.type == pygame.MOUSEBUTTONDOWN:
            pos = pygame.mouse.get_pos()
            col = pos[0]
            row = pos[1]
# Inside the mouse click event handling block
        if selected_piece:
            board[selected_pos[0]][selected_pos[1]] = ' '
            selected_pos = [row, col]
            board[row][col] = selected_piece
            selected_piece = None
            draw_board()
        else:
            pos = pygame.mouse.get_pos()
            col = pos[0]
            row = pos[1]
            if board[row][col] != ' ':
                selected_piece = board[row][col]
                selected_pos = [row, col]

        if selected_piece:
            # Draw a highlight around the selected piece
            pygame.draw.rect(screen, (255, 0, 0), (selected_pos[1] * square_size, selected_pos[0] * square_size, square_size, square_size), 4)

# Quit pygame
pygame.quit()
</code>```

I believe I have some issues going on with the scope of calling the variable

I haven't exactly used pygame before and would be happy to use another library if it fixes my issue

Body:
I am making a chess board in python using pygame and since I am relatively new to python and my friend wrote some code we both don't understand we are dumbfounded trying to debug this program.

Here is my error

Traceback (most recent call last):
  File "/home/travisfiorito/Documents/Doggy rewrite/OtherProject/Play-Around/ChessAI/AI.py", line 99, in <module>
    draw_board()
  File "/home/travisfiorito/Documents/Doggy rewrite/OtherProject/Play-Around/ChessAI/AI.py", line 83, in draw_board
    screen.blit(image, (j * square_size, i * square_size))
UnboundLocalError: local variable 'image' referenced before assignment

Here is my code

import sys
import os
import subprocess
import pygame
from PIL import Image
def install(package):
    subprocess.check_call([sys.executable, "-m", "pip", "install", package])

install("pygame")
pygame.init()
os.environ['SDL_AUDIODRIVER'] = 'dsp'
#os.environ["SDL_VIDEODRIVER"] = 'dummy'

image_filenames = ['/path/to/img/black_bishop.png', '/path/to/img/black_king.png', '/path/to/img/black_knight.png', '/path/to/img/black_pawn.png','/path/to/img/black_queen.png','/path/to/img/black_rook.png','/path/to/img/white_bishop.png', '/path/to/img/white_king.png', '/path/to/img/white_knight.png', '/path/to/img/white_pawn.png', '/path/to/img/white_queen.png', '/path/to/img/white_rook.png']
images = {}

window_size = 400
square_size = window_size // 8

pygame.display.set_caption('Scuffed Chess ai')
icon = pygame.Surface((1, 1))
icon.set_alpha(0)
pygame.display.set_icon(icon)
screen = pygame.display.set_mode((window_size, window_size))
screen.fill((255, 255, 255))

global board
board = [
    ['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'],
    ['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'],
    [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
    [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
    [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
    [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
    ['P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'],
    ['R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R']
]

selected_piece = None
selected_pos = None
selected_pos = []
images = {filename: pygame.image.load(filename) for filename in image_filenames}
image = None
def draw_board():
    for i in range(8):  # iterate from 0 to 7
        for j in range(8):  # iterate from 0 to 7
            color = (255, 255, 255) if (i + j) % 2 == 0 else (0, 0, 0)
            pygame.draw.rect(screen, color, (i * square_size, j * square_size, square_size, square_size))
    for i in range(8):  # iterate from 0 to 7
        for j in range(8):  # iterate from 0 to 7
            piece = board[i][j]
            if piece != ' ':
                if piece.islower():
                    color = (255, 255, 255)
                else:
                    color = (0, 0, 0)
                if piece == 'p':
                    image = images['black_pawn']
                elif piece == 'r':
                    image = images['black_rook']
                elif piece == 'n':
                    image = images['black_knight']
                elif piece == 'b':
                    image = images['black_bishop']
                elif piece == 'q':
                    image = images['black_queen']
                elif piece == 'k':
                    image = images['black_king']
                elif piece == 'P':
                    image = images['white_pawn']
                elif piece == 'R':
                    image = images['white_rook']
                elif piece == 'N':
                    image = images['white_knight']
                elif piece == 'B':
                    image = images['white_bishop']
                elif piece == 'Q':
                    image = images['white_queen']
                elif piece == 'K':
                    image = images['white_king']
                screen.blit(image, (j * square_size, i * square_size))

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        elif event.type == pygame.MOUSEBUTTONDOWN:
            pos = pygame.mouse.get_pos()
            col = pos[0]
            row = pos[1]
# Inside the mouse click event handling block
        if selected_piece:
            board[selected_pos[0]][selected_pos[1]] = ' '
            selected_pos = [row, col]
            board[row][col] = selected_piece
            selected_piece = None
            draw_board()
        else:
            pos = pygame.mouse.get_pos()
            col = pos[0]
            row = pos[1]
            if board[row][col] != ' ':
                selected_piece = board[row][col]
                selected_pos = [row, col]

        if selected_piece:
            # Draw a highlight around the selected piece
            pygame.draw.rect(screen, (255, 0, 0), (selected_pos[1] * square_size, selected_pos[0] * square_size, square_size, square_size), 4)

# Quit pygame
pygame.quit()

I believe I have some issues going on with the scope of calling the variable

I haven't exactly used pygame before and would be happy to use another library if it fixes my issue


问:
Get error/notification when cloud function fails to upload file into BQ
I created a cloud function that:

Whenever a new file is uploaded into the google storage bucket, Function gets triggered and uploads that into bigquery

The function is running smoothly but I have a question. Another person uploads CSV into the bucket and I assured her the data will be pushed into BigQuery straightaway. How I can get informed whenever an upload fails? (She may upload hundreds of files per day)

If I open the bucket is there any way to understand which file is uploaded and which failed?


问:
How to perform autocorrelation, heteroscedasticity and multicollinearity tests using the package ‘systemfit’ in R?
I'm estimating a system of equations with Seemingly Unrelated Regression (SUR) of the ‘systemfit’ package, but in the documentation I have not found how to perform the autocorrelation, heteroscedasticity and multicollinearity tests (Variance Inflation Factor, Breusch–Pagan, etc.).

vif() and bptest() don't work for system of equations.


问:
Pyglet sprite.draw() crashing on iGPU
I've written the following python loop to display multiple gif files one after another. The code works fine on one of my machines with a dedicated GPU but only displays one gif on my laptop with an AMD iGPU displaying the following error msg after closing the first window (both PCs run windows 10):

```<code>import pyglet

def play_animation(ag_file):
    animation = pyglet.image.load_animation(ag_file)
    sprite = pyglet.sprite.Sprite(animation)
    win = pyglet.window.Window(width=sprite.width, height=sprite.height)
    green = 0, 1, 0, 1
    pyglet.gl.glClearColor(*green)

    @win.event
    def on_draw():
        win.clear()
        sprite.draw()
    pyglet.app.run()

if __name__ == '__main__':
    gif_list = ['gif1.gif', 'gif2.gif']
    for gif in gif_list:
        print(gif)
        play_animation(gif)
</code>```

And the error I get after I close the first animation is:

```<code>gif1.gif
gif2.gif
Traceback (most recent call last):
  File "main.py", line 226, in <module>
    play_animation(Save_Name)
  File "main.py", line 29, in play_animation
    pyglet.app.run()
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\__init__.py", line 107, in run
    event_loop.run(interval)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\base.py", line 186, in run
    timeout = self.idle()
              ^^^^^^^^^^^
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\base.py", line 247, in idle
    self.clock.call_scheduled_functions(dt)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\clock.py", line 262, in call_scheduled_functions
    item.func(now - item.last_ts, *item.args, **item.kwargs)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\base.py", line 153, in _redraw_windows
    window.dispatch_event('on_draw')
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\window\__init__.py", line 1363, in dispatch_event
    super().dispatch_event(*args)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\event.py", line 415, in dispatch_event
    if handler(*args):
       ^^^^^^^^^^^^^^
  File "main.py", line 19, in on_draw
    sprite.draw()
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\sprite.py", line 820, in draw
    self._vertex_list.draw(GL_TRIANGLES)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\graphics\vertexdomain.py", line 276, in draw
    self.domain.draw_subset(mode, self)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\graphics\vertexdomain.py", line 491, in draw_subset
    self.vao.bind()
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\graphics\vertexarray.py", line 58, in bind
    glBindVertexArray(self._id)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\gl\lib.py", line 114, in errcheck
    raise GLException('(0x%x): %s' % (error, msg))
pyglet.gl.lib.GLException: (0x502): Invalid operation. The specified operation is not allowed in the current state.
</code>```

I updated the driver on both machines and installed the latest version of python (3.11) and pyglet (2.0.2.1) as well as all Updates for windows

Title: Pyglet sprite.draw() crashing on iGPU

Body:
I've written the following python loop to display multiple gif files one after another. The code works fine on one of my machines with a dedicated GPU but only displays one gif on my laptop with an AMD iGPU displaying the following error msg after closing the first window (both PCs run windows 10):

import pyglet

def play_animation(ag_file):
    animation = pyglet.image.load_animation(ag_file)
    sprite = pyglet.sprite.Sprite(animation)
    win = pyglet.window.Window(width=sprite.width, height=sprite.height)
    green = 0, 1, 0, 1
    pyglet.gl.glClearColor(*green)

    @win.event
    def on_draw():
        win.clear()
        sprite.draw()
    pyglet.app.run()

if __name__ == '__main__':
    gif_list = ['gif1.gif', 'gif2.gif']
    for gif in gif_list:
        print(gif)
        play_animation(gif)

And the error I get after I close the first animation is:

gif1.gif
gif2.gif
Traceback (most recent call last):
  File "main.py", line 226, in <module>
    play_animation(Save_Name)
  File "main.py", line 29, in play_animation
    pyglet.app.run()
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\__init__.py", line 107, in run
    event_loop.run(interval)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\base.py", line 186, in run
    timeout = self.idle()
              ^^^^^^^^^^^
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\base.py", line 247, in idle
    self.clock.call_scheduled_functions(dt)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\clock.py", line 262, in call_scheduled_functions
    item.func(now - item.last_ts, *item.args, **item.kwargs)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\app\base.py", line 153, in _redraw_windows
    window.dispatch_event('on_draw')
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\window\__init__.py", line 1363, in dispatch_event
    super().dispatch_event(*args)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\event.py", line 415, in dispatch_event
    if handler(*args):
       ^^^^^^^^^^^^^^
  File "main.py", line 19, in on_draw
    sprite.draw()
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\sprite.py", line 820, in draw
    self._vertex_list.draw(GL_TRIANGLES)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\graphics\vertexdomain.py", line 276, in draw
    self.domain.draw_subset(mode, self)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\graphics\vertexdomain.py", line 491, in draw_subset
    self.vao.bind()
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\graphics\vertexarray.py", line 58, in bind
    glBindVertexArray(self._id)
  File "C:\Users\..\AppData\Roaming\Python\Python311\site-packages\pyglet\gl\lib.py", line 114, in errcheck
    raise GLException('(0x%x): %s' % (error, msg))
pyglet.gl.lib.GLException: (0x502): Invalid operation. The specified operation is not allowed in the current state.

I updated the driver on both machines and installed the latest version of python (3.11) and pyglet (2.0.2.1) as well as all Updates for windows


问:
Multiprocessing or multithreading for my Rich UI in python
Okay so I'm writing a commandline program in python using the Rich library for my UI basically. Now I've written a method that changes the color of the program logo (Text) every second to create a simple RGB animation. Now when I run the animation using a Thread, because the animation is in an infnite loop, I cant close the program even after using Ctrl+C. It just keeps playing the animation except I close the terminal in PyCharm. But when I use a process instead, everything works fine. So my question is, what am I supposed to use to do the animation task according to good programming ethics. And if I'm supposed to use a Thread, what am I doing wrong? And what am I supposed to do to so I can close the program when I want to.

By the way I already tried animationThread.join() but I guess it didn't work because the main thread was still waiting for the infinite loop to finish


问:
how pass and change url with query
so I do a little project with react and node js
and i do a search function that work fine but I just have a little problem i try to figure

I do a function that I search for items with a search word that I send in query and categories to filter in req.body
so I send a post request to my back-end and I want to change the url client by the values I post to the server

for example lets say my url is localhost:3001/home
and i send to the server the serach word "football" and in categories I send sport

so i want my url look like this localhost:3001/home?search=football&cate=sport

i add here my code from the front

look on the function "searchFun"

React, { useEffect, useState } from "react";
import axios from "axios"
import { useNavigate } from "react-router-dom";
import BookItem from "../bookItem/bookItem";
import './Home.css'
import Logo from "../logo/logo";
import Checkbox from "../CheckBox/CheckBox";

function HomePage() {
    const [comedyBooks, setComedy] = useState([])
    const [sportBooks, setSport] = useState([])
    const [actionBooks, setAction] = useState([])
    const [displaySearch, setDisplaySearch] = useState([])
    const [search, setSearch] = useState('')
    const [boxFilter, setBoxFilter] = useState({
        comedy: false,
        action: false,
        sport: false,
    })

    let navigate = useNavigate();

    useEffect(() => {
        let booksArr = []
        let comedyBook = []
        let sportBook = []
        let actionBook = []

        axios.get('http://127.0.0.1:3000/books')
            .then(async res => {
                res.data.data.books.map(el => {
                    booksArr.push(el)
                })
                comedyBook = booksArr.filter(el => el.categories == 'comedy')
                sportBook = booksArr.filter(el => el.categories == 'sport')
                actionBook = booksArr.filter(el => el.categories == 'action')
                setAction(actionBook)
                setSport(sportBook)
                setComedy(comedyBook)

            })
    }, [])

    const searchFun = () => {
        try {
            axios.create({ withCredentials: true }).post(`http://127.0.0.1:3000/books/search?search=${search}`, {
                categories: boxFilter
            })
                .then(res => {
                    console.log(res.data.data1)
                    setDisplaySearch(res.data.data1)
                })
        } catch (error) {
            console.log((error))
        }
    }

    const handleChangeAction = () => {
        setBoxFilter({ ...boxFilter, action: !boxFilter.action })
    }
    const handleChangeSport = () => {
        setBoxFilter({ ...boxFilter, sport: !boxFilter.sport })
    }
    const handleChangeComedy = () => {
        setBoxFilter({ ...boxFilter, comedy: !boxFilter.comedy })
    }

    return (

                <Logo />

                <input onChange={(e) => setSearch(e.target.value)} placeholder="Search..." />
                <button onClick={searchFun}>Search</button>
                <Checkbox label='action' value={boxFilter.action} onChange={handleChangeAction} />
                <Checkbox label='sport' value={boxFilter.sport} onChange={handleChangeSport} />
                <Checkbox label='comedy' value={boxFilter.comedy} onChange={handleChangeComedy} />

            {/*
 */}
            {displaySearch.length >= 1 ? displaySearch.map(item => {
                return <BookItem key={item._id} item={item} />
            }) : null}
            {/*
 */}

Comedy Books

                    {comedyBooks.map(item => {
                        return <BookItem key={item._id} item={item} />
                    })}

Sport Books

                    {sportBooks.map(item => {
                        return <BookItem key={item._id} item={item} />
                    })}

Action Books

                    {actionBooks.map(item => {
                        return <BookItem key={item._id} item={item} />
                    })}

    )
}

export default HomePage```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script></code>```

my App component

import React, {  useState } from "react";
import { Routes, Route } from "react-router-dom";
import './app.css'
import Account from "./Components/account/account";
import AddBook from "./Components/AddBook/AddBook";
import ForgetPassword from "./Components/auth/forgetpassword/forgetpassword";
import Login from "./Components/auth/login/Login";
import ResetPassword from "./Components/auth/resetPassword/resetPassword";
import SignIn from "./Components/auth/sign-in/Sign-in";
import DisplayBook from "./Components/displayBook/displayBook";
import DisplayCart from "./Components/displayCart/displayCart";
import Home from './Components/Home/Home'
import Logo from "./Components/logo/logo";
import MyBooks from "./Components/mybooks/mybooks";
import NavBar from './Components/navBar/navBar'

function App() {
  const [cookie, setCookie] = useState()
  const name = "elyasaf"

  return (

      <NavBar set={setCookie} />
      {/* <Logo /> */}
      <Routes>
        <Route path="/" element={<Home />} />
        <Route path="/login" element={<Login set={setCookie} />} />
        <Route path="/myAccount" element={<Account />} />
        <Route path="/logo" element={<Logo />} />
        <Route path="/sign-in" element={<SignIn />} />
        <Route path="/forgetpassword" element={<ForgetPassword />} />
        <Route path="/users/resetPassword/:token" element={<ResetPassword />} />
        <Route path="/addBook" element={<AddBook />} />
        <Route path="/MyBooks" element={<MyBooks />} />
        <Route path="/MyCart" element={<DisplayCart />} />
        <Route path="/book/:bookId" element={<DisplayBook />} />
      </Routes>

  );
}

export default App;```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script></code>```

Title: how pass and change url with query

Body:
so I do a little project with react and node js
and i do a search function that work fine but I just have a little problem i try to figure

I do a function that I search for items with a search word that I send in query and categories to filter in req.body
so I send a post request to my back-end and I want to change the url client by the values I post to the server

for example lets say my url is localhost:3001/home
and i send to the server the serach word "football" and in categories I send sport

so i want my url look like this localhost:3001/home?search=football&cate=sport

i add here my code from the front

look on the function "searchFun"

React, { useEffect, useState } from "react";
import axios from "axios"
import { useNavigate } from "react-router-dom";
import BookItem from "../bookItem/bookItem";
import './Home.css'
import Logo from "../logo/logo";
import Checkbox from "../CheckBox/CheckBox";

function HomePage() {
    const [comedyBooks, setComedy] = useState([])
    const [sportBooks, setSport] = useState([])
    const [actionBooks, setAction] = useState([])
    const [displaySearch, setDisplaySearch] = useState([])
    const [search, setSearch] = useState('')
    const [boxFilter, setBoxFilter] = useState({
        comedy: false,
        action: false,
        sport: false,
    })

    let navigate = useNavigate();

    useEffect(() => {
        let booksArr = []
        let comedyBook = []
        let sportBook = []
        let actionBook = []

        axios.get('http://127.0.0.1:3000/books')
            .then(async res => {
                res.data.data.books.map(el => {
                    booksArr.push(el)
                })
                comedyBook = booksArr.filter(el => el.categories == 'comedy')
                sportBook = booksArr.filter(el => el.categories == 'sport')
                actionBook = booksArr.filter(el => el.categories == 'action')
                setAction(actionBook)
                setSport(sportBook)
                setComedy(comedyBook)

            })
    }, [])

    const searchFun = () => {
        try {
            axios.create({ withCredentials: true }).post(`http://127.0.0.1:3000/books/search?search=${search}`, {
                categories: boxFilter
            })
                .then(res => {
                    console.log(res.data.data1)
                    setDisplaySearch(res.data.data1)
                })
        } catch (error) {
            console.log((error))
        }
    }

    const handleChangeAction = () => {
        setBoxFilter({ ...boxFilter, action: !boxFilter.action })
    }
    const handleChangeSport = () => {
        setBoxFilter({ ...boxFilter, sport: !boxFilter.sport })
    }
    const handleChangeComedy = () => {
        setBoxFilter({ ...boxFilter, comedy: !boxFilter.comedy })
    }

    return (

                <Logo />

                <input onChange={(e) => setSearch(e.target.value)} placeholder="Search..." />
                <button onClick={searchFun}>Search</button>
                <Checkbox label='action' value={boxFilter.action} onChange={handleChangeAction} />
                <Checkbox label='sport' value={boxFilter.sport} onChange={handleChangeSport} />
                <Checkbox label='comedy' value={boxFilter.comedy} onChange={handleChangeComedy} />

            {/*
 */}
            {displaySearch.length >= 1 ? displaySearch.map(item => {
                return <BookItem key={item._id} item={item} />
            }) : null}
            {/*
 */}

Comedy Books

                    {comedyBooks.map(item => {
                        return <BookItem key={item._id} item={item} />
                    })}

Sport Books

                    {sportBooks.map(item => {
                        return <BookItem key={item._id} item={item} />
                    })}

Action Books

                    {actionBooks.map(item => {
                        return <BookItem key={item._id} item={item} />
                    })}

    )
}

export default HomePage

my App component

import React, {  useState } from "react";
import { Routes, Route } from "react-router-dom";
import './app.css'
import Account from "./Components/account/account";
import AddBook from "./Components/AddBook/AddBook";
import ForgetPassword from "./Components/auth/forgetpassword/forgetpassword";
import Login from "./Components/auth/login/Login";
import ResetPassword from "./Components/auth/resetPassword/resetPassword";
import SignIn from "./Components/auth/sign-in/Sign-in";
import DisplayBook from "./Components/displayBook/displayBook";
import DisplayCart from "./Components/displayCart/displayCart";
import Home from './Components/Home/Home'
import Logo from "./Components/logo/logo";
import MyBooks from "./Components/mybooks/mybooks";
import NavBar from './Components/navBar/navBar'

function App() {
  const [cookie, setCookie] = useState()
  const name = "elyasaf"

  return (

      <NavBar set={setCookie} />
      {/* <Logo /> */}
      <Routes>
        <Route path="/" element={<Home />} />
        <Route path="/login" element={<Login set={setCookie} />} />
        <Route path="/myAccount" element={<Account />} />
        <Route path="/logo" element={<Logo />} />
        <Route path="/sign-in" element={<SignIn />} />
        <Route path="/forgetpassword" element={<ForgetPassword />} />
        <Route path="/users/resetPassword/:token" element={<ResetPassword />} />
        <Route path="/addBook" element={<AddBook />} />
        <Route path="/MyBooks" element={<MyBooks />} />
        <Route path="/MyCart" element={<DisplayCart />} />
        <Route path="/book/:bookId" element={<DisplayBook />} />
      </Routes>

  );
}

export default App;


问:
Propagating time attribute after an interval join, to do window aggregation later
I am attempting to change query 4 (Average Price for a category) from nexmark benchmark to produce an append only stream of average price for a category, using only flink sql as much as possible.

Query for the original description is available here in the nexmark benchmark repository.

This query produces an updating stream. I would like to instead produce an append only stream.

My approach was

Do an interval join between auction and bid, group by bid and select the max price. This creates sell price for each item. This produces updates and deletes due to group by.

Convert [1] to a windowed aggregate, in an attempt to convert [1] to an append only stream. Here I need a time attribute, and I am not sure how to propagate time attribute from [1] here.

To summarize, how can we propagate time attribute from an interval join, to do a window aggregation afterwards?

Here is the sql I used

WITH auction AS (
    Select dateTime SystemTime, auction.* from datagen2 where event_type = 1
),
bid AS(
    Select dateTime SystemTime, bid.* from datagen2 where event_type = 2
),
--Interval join.
MaxSellPricePerCategory AS (
select
    auction.id AuctionId,
    auction.category,
    max(bid.price) SellPrice,
    max(bid.SystemTime) BidSystemTime,
    max(bid.dateTime) LastBidTime
from
    auction
join
    bid
on
    auction.id = bid.auction
    --Add a condition on rowtime to make this a interval join
    and bid.SystemTime between auction.SystemTime and auction.SystemTime + INTERVAL '50' MINUTES
    --bid should be during the auction active time.
    and bid.dateTime between auction.dateTime and auction.expires
group by
    auction.id,
    auction.category
),
AverageSellPricePerWindow AS (
select
    window_start,
    category,
    AVG(SellPrice) AverageSellPriceInWindow
from
    TABLE(
        TUMBLE(TABLE MaxSellPricePerCategory, DESCRIPTOR(BidSystemTime), INTERVAL '1' MINUTES)
    )
GROUP BY
    window_start,
    window_end,
    category
)

select * from AverageSellPricePerWindow;
```
<p>It fails with below</p>
```org.apache.flink.table.api.ValidationException: The window function requires the timecol is a time attribute type, but is TIMESTAMP(3).
```

Other approaches considered

Use a window join. This requires the two stream's window to align (i.e. it requires equality condition on window_start and window_end). Business logic defines it as an overlapping interval.

Use an upsert sink. This works, but was not my final goal.

Body:
I am attempting to change query 4 (Average Price for a category) from nexmark benchmark to produce an append only stream of average price for a category, using only flink sql as much as possible.

Query for the original description is available here in the nexmark benchmark repository.

This query produces an updating stream. I would like to instead produce an append only stream.

My approach was

Do an interval join between auction and bid, group by bid and select the max price. This creates sell price for each item. This produces updates and deletes due to group by.

Convert [1] to a windowed aggregate, in an attempt to convert [1] to an append only stream. Here I need a time attribute, and I am not sure how to propagate time attribute from [1] here.

To summarize, how can we propagate time attribute from an interval join, to do a window aggregation afterwards?

Here is the sql I used

WITH auction AS (
    Select dateTime SystemTime, auction.* from datagen2 where event_type = 1
),
bid AS(
    Select dateTime SystemTime, bid.* from datagen2 where event_type = 2
),
--Interval join.
MaxSellPricePerCategory AS (
select
    auction.id AuctionId,
    auction.category,
    max(bid.price) SellPrice,
    max(bid.SystemTime) BidSystemTime,
    max(bid.dateTime) LastBidTime
from
    auction
join
    bid
on
    auction.id = bid.auction
    --Add a condition on rowtime to make this a interval join
    and bid.SystemTime between auction.SystemTime and auction.SystemTime + INTERVAL '50' MINUTES
    --bid should be during the auction active time.
    and bid.dateTime between auction.dateTime and auction.expires
group by
    auction.id,
    auction.category
),
AverageSellPricePerWindow AS (
select
    window_start,
    category,
    AVG(SellPrice) AverageSellPriceInWindow
from
    TABLE(
        TUMBLE(TABLE MaxSellPricePerCategory, DESCRIPTOR(BidSystemTime), INTERVAL '1' MINUTES)
    )
GROUP BY
    window_start,
    window_end,
    category
)

select * from AverageSellPricePerWindow;

It fails with below

org.apache.flink.table.api.ValidationException: The window function requires the timecol is a time attribute type, but is TIMESTAMP(3).

Other approaches considered

Use a window join. This requires the two stream's window to align (i.e. it requires equality condition on window_start and window_end). Business logic defines it as an overlapping interval.

Use an upsert sink. This works, but was not my final goal.


问:
How to find world position from its pixel position in Unity by using projectionMatrix?
I am trying to find world coordinates of the target object from its pixel coordinate in Unity.
First : I converted the pixel coordinates to normalized device coordinates (NDC).
Second : I multiplied the 4D vector by the inverse of the projection matrix.
Then I found the target vector. But it is not correct and I could not find the solution. Which part of my code is wrong?

My outputs :

targetPixelCoord pixelX, pixelY : (1752.386,540)

targetWorldCoord(0.04, 0.02, -2.00) // it is calculated by code

targetWorldCoord(Positional :8,0,4) //Originally it is setted this values, there is no rotation

```<code>   void findTargetPixel2World(float pixelX, float pixelY, float pixelZ)
 {

    float screenWidth = 1920;
    float screenHeight = 1080;
    float nearClipPlane = 1f;
    float farClipPlane = 30f;

    float NDCx = pixelX / screenWidth * 2 - 1;
    float NDCy = pixelY / screenHeight * 2 - 1;

    Vector4 ndcPoint = new Vector4(NDCx, NDCx, nearClipPlane, farClipPlane);

    Debug.Log("ndcPoint" + ndcPoint);

    Matrix4x4 projectionMatrixInverse = mainCam.projectionMatrix.inverse;
    Vector4 worldPoint = projectionMatrixInverse * ndcPoint;
    Vector3 targetWorldCoord = new Vector3(worldPoint.x / worldPoint.w, worldPoint.y / worldPoint.w, worldPoint.z / worldPoint.w);

    Debug.Log("targetWorldCoord" + targetWorldCoord);
    }
</code>```

Body:
I am trying to find world coordinates of the target object from its pixel coordinate in Unity.
First : I converted the pixel coordinates to normalized device coordinates (NDC).
Second : I multiplied the 4D vector by the inverse of the projection matrix.
Then I found the target vector. But it is not correct and I could not find the solution. Which part of my code is wrong?

My outputs :

targetPixelCoord pixelX, pixelY : (1752.386,540)

targetWorldCoord(0.04, 0.02, -2.00) // it is calculated by code

targetWorldCoord(Positional :8,0,4) //Originally it is setted this values, there is no rotation

   void findTargetPixel2World(float pixelX, float pixelY, float pixelZ)
 {

    float screenWidth = 1920;
    float screenHeight = 1080;
    float nearClipPlane = 1f;
    float farClipPlane = 30f;

    float NDCx = pixelX / screenWidth * 2 - 1;
    float NDCy = pixelY / screenHeight * 2 - 1;

    Vector4 ndcPoint = new Vector4(NDCx, NDCx, nearClipPlane, farClipPlane);

    Debug.Log("ndcPoint" + ndcPoint);

    Matrix4x4 projectionMatrixInverse = mainCam.projectionMatrix.inverse;
    Vector4 worldPoint = projectionMatrixInverse * ndcPoint;
    Vector3 targetWorldCoord = new Vector3(worldPoint.x / worldPoint.w, worldPoint.y / worldPoint.w, worldPoint.z / worldPoint.w);

    Debug.Log("targetWorldCoord" + targetWorldCoord);
    }


问:
How to inline bold a text for a pdf generated with FPDF in Python using a font that supports Unicode UTF-8
I am making a Python script to generate a PDF document with FPDF2, I have a problem when rendering this document, in one of the paragraphs some words and phrases must be in bold, I had managed to solve this problem using multi-cell and activating the MARKDOWN, or using write_html() everything worked perfectly until in one of the texts that I have saved in a .txt format that I am using to make the PDF the unicode character  " appears, throwing the following error:

fpdf.errors.FPDFUnicodeEncodingException: Character "“" at index 544 in text is outside the range of characters supported by the font  used: "times". Please consider using a Unicode font.

The next thing I did was download a font from Google fonts and add it with add_font()

```<code>texto1 = f"""**{nombre}**, mayor de edad, vecino de **{ciudad_usuario}**, identificado con la **{id_tipo}**
 No. **{id_numero}** expedida en **{id_lugar_expedicion}**, actuando con mi propio nombre y ... """
fuente_tipo = "SourceSerifPro-Regular"
class PDF(FPDF):
    def __init__(self):
        FPDF.__init__(self, unit="mm", format="letter", orientation="P")
        self.add_font("SourceSerifPro-Regular", "", "SourceSerifPro-Regular.ttf")

    def header(self):
        self.set_xy(25, 10)
        self.set_font(fuente_tipo, '', 12)
        self.ln(15)
        self.cell(0, 10, fecha, 0)
        self.ln(15)

    def footer(self):
        self.set_xy(185, -15)
        self.set_font(family= fuente_tipo, size= 8)
        self.cell(0, 10, 'Página ' + str(self.page_no()) + ' de n', 0)

    def add_txt_text(self, route):
        with open(route, "r", encoding="utf-8") as f:
            texto = f.read()
        self.multi_cell(0, None, texto, markdown = True, new_x='LEFT', new_y= 'NEXT')

pdf = PDF()
pdf.set_margins(25, 30, 10)
pdf.add_page()
pdf.set_auto_page_break(auto=True, margin=20)
pdf.set_font(fuente_tipo, '', 12)
pdf.multi_cell(0, None,  texto1, markdown = True, new_x='LEFT', new_y= 'NEXT') # max_line_height=30,
# This text has a unicode caracter
pdf.add_txt_text('fundamento_juridico.txt')
pdf.output('ejemplo.pdf')
</code>```

FDPF has 3 default fonts, which do not support some utf-8 characters, as soon as I add the Google font it throws the following error.

```<code> File "C:\Users\user\Documents\PDF_generator\index.py", line 101, in <module>
    pdf.multi_cell(0, None,  texto1, markdown = True, new_x='LEFT', new_y= 'NEXT') # max_line_height=30,
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\fpdf\fpdf.py", line 216, in wrapper
    return fn(self, *args, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\fpdf\fpdf.py", line 3213, in multi_cell
    styled_text_fragments = self._preload_font_styles(normalized_string, markdown)
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\fpdf\fpdf.py", line 3004, in _preload_font_styles
    self.set_font(style="B")
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\fpdf\fpdf.py", line 1873, in set_font
    raise FPDFException(
fpdf.errors.FPDFException: Undefined font: sourceserifpro-regularB - Use built-in fonts or FPDF.add_font() beforehand
</code>```

Now I see myself between eliminating those types of characters in the texts that I use to generate the pdf, or not being able to use in-line bold in some texts.
Any advice or solution to this problem is appreciated.

I want to make a pdf in which I can add some text I have, and I want to be able to do in-line bold and use Unicode characters, also I want that when the text reach the bottom margin it creates another page.

Body:
I am making a Python script to generate a PDF document with FPDF2, I have a problem when rendering this document, in one of the paragraphs some words and phrases must be in bold, I had managed to solve this problem using multi-cell and activating the MARKDOWN, or using write_html() everything worked perfectly until in one of the texts that I have saved in a .txt format that I am using to make the PDF the unicode character  " appears, throwing the following error:

fpdf.errors.FPDFUnicodeEncodingException: Character "“" at index 544 in text is outside the range of characters supported by the font  used: "times". Please consider using a Unicode font.

The next thing I did was download a font from Google fonts and add it with add_font()

texto1 = f"""**{nombre}**, mayor de edad, vecino de **{ciudad_usuario}**, identificado con la **{id_tipo}**
 No. **{id_numero}** expedida en **{id_lugar_expedicion}**, actuando con mi propio nombre y ... """
fuente_tipo = "SourceSerifPro-Regular"
class PDF(FPDF):
    def __init__(self):
        FPDF.__init__(self, unit="mm", format="letter", orientation="P")
        self.add_font("SourceSerifPro-Regular", "", "SourceSerifPro-Regular.ttf")

    def header(self):
        self.set_xy(25, 10)
        self.set_font(fuente_tipo, '', 12)
        self.ln(15)
        self.cell(0, 10, fecha, 0)
        self.ln(15)

    def footer(self):
        self.set_xy(185, -15)
        self.set_font(family= fuente_tipo, size= 8)
        self.cell(0, 10, 'Página ' + str(self.page_no()) + ' de n', 0)

    def add_txt_text(self, route):
        with open(route, "r", encoding="utf-8") as f:
            texto = f.read()
        self.multi_cell(0, None, texto, markdown = True, new_x='LEFT', new_y= 'NEXT')

pdf = PDF()
pdf.set_margins(25, 30, 10)
pdf.add_page()
pdf.set_auto_page_break(auto=True, margin=20)
pdf.set_font(fuente_tipo, '', 12)
pdf.multi_cell(0, None,  texto1, markdown = True, new_x='LEFT', new_y= 'NEXT') # max_line_height=30,
# This text has a unicode caracter
pdf.add_txt_text('fundamento_juridico.txt')
pdf.output('ejemplo.pdf')

FDPF has 3 default fonts, which do not support some utf-8 characters, as soon as I add the Google font it throws the following error.

 File "C:\Users\user\Documents\PDF_generator\index.py", line 101, in <module>
    pdf.multi_cell(0, None,  texto1, markdown = True, new_x='LEFT', new_y= 'NEXT') # max_line_height=30,
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\fpdf\fpdf.py", line 216, in wrapper
    return fn(self, *args, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\fpdf\fpdf.py", line 3213, in multi_cell
    styled_text_fragments = self._preload_font_styles(normalized_string, markdown)
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\fpdf\fpdf.py", line 3004, in _preload_font_styles
    self.set_font(style="B")
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\fpdf\fpdf.py", line 1873, in set_font
    raise FPDFException(
fpdf.errors.FPDFException: Undefined font: sourceserifpro-regularB - Use built-in fonts or FPDF.add_font() beforehand

Now I see myself between eliminating those types of characters in the texts that I use to generate the pdf, or not being able to use in-line bold in some texts.
Any advice or solution to this problem is appreciated.

I want to make a pdf in which I can add some text I have, and I want to be able to do in-line bold and use Unicode characters, also I want that when the text reach the bottom margin it creates another page.


问:
Java editor in Eclipse STS sometimes has jittery lines
I drink a lot of coffee. But I don't spill on the keyboard. And I don't type this fast. And yet, sometimes my STS Eclipse 4.14 sometimes does this when I'm scrolling through a file of several hundred lines:

This is in a Maven-based project of about 350 Java files across implementation and test classes, running on a Dell Inc. XPS 13 9310 (11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz × 8) laptop with Ubuntu 22.04.1 LTS with GNOME 42.5 and Wayland windowing:

About Eclipse STS:

```<code>Spring Tool Suite 4

Version: 4.14.1.RELEASE
Build Id: 202204250734

Copyright (c) 2007 - 2022 VMware, Inc.
All rights reserved. Visit https://spring.io/tools

This product includes software developed by the
Eclipse Foundation https://www.eclipse.org

This product includes software developed by the
Apache Software Foundation https://www.apache.org

Lombok v1.18.24 "Envious Ferret" is installed. https://projectlombok.org/
</code>```

Obviously not a programming question but this audience is likely the only folks who might have seen this...anyone?

When in this wacky state, pressing keys with no editor buffer impact (e.g. shift keys, arrow keys) does nothing to change behavior but pressing a key with editor buffer impact (e.g., space bar, letters, backspace, etc.) stops the wacky behavior. So this behavior makes me lean toward a software problem instead of keyboard hardware issue.

FWIW, I don't see this wacky behavior in my desktop environment running openSUSE 15.4.

Update: Similar behavior in STS Eclipse 4.17:

```<code>Spring Tool Suite 4

Version: 4.17.0.RELEASE
Build Id: 202212060857
Revision: e5d4f36a56c66862556fb938ade6c05abce57d39

Copyright (c) 2007 - 2022 VMware, Inc.
All rights reserved. Visit https://spring.io/tools

This product includes software developed by the
Eclipse Foundation https://www.eclipse.org

This product includes software developed by the
Apache Software Foundation https://www.apache.org

Lombok v1.18.24 "Envious Ferret" is installed. https://projectlombok.org/
</code>```

Update 2: Similar behavior in Eclipse IDE 2022-12:

```<code>Eclipse IDE for Java Developers (includes Incubating components)

Version: 2022-12 (4.26.0)
Build id: 20221201-1913
(c) Copyright Eclipse contributors and others 2000, 2022.  All rights reserved. Eclipse and the Eclipse logo are trademarks of the Eclipse Foundation, Inc., https://www.eclipse.org/. The Eclipse logo cannot be altered without Eclipses permission. Eclipse logos are provided for use under the Eclipse logo and trademark guidelines, https://www.eclipse.org/logotm/. Oracle and Java are trademarks or registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

This product includes software developed by other open source projects including the Apache Software Foundation, https://www.apache.org/.

Lombok v1.18.24 "Envious Ferret" is installed. https://projectlombok.org/
</code>```

Update 3: Similar behavior in Eclipse SDK without Lombok:

```<code>Eclipse SDK
Version: 2022-12 (4.26)
Build id: I20221123-1800
OS: Linux, v.5.14.0-1052-oem, x86_64 / gtk 3.24.33, WebKit 2.38.2
Java vendor: Oracle Corporation
Java runtime version: 19+36-2238
Java version: 19
</code>```

Body:
I drink a lot of coffee. But I don't spill on the keyboard. And I don't type this fast. And yet, sometimes my STS Eclipse 4.14 sometimes does this when I'm scrolling through a file of several hundred lines:

This is in a Maven-based project of about 350 Java files across implementation and test classes, running on a Dell Inc. XPS 13 9310 (11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz × 8) laptop with Ubuntu 22.04.1 LTS with GNOME 42.5 and Wayland windowing:

About Eclipse STS:

Spring Tool Suite 4

Version: 4.14.1.RELEASE
Build Id: 202204250734

Copyright (c) 2007 - 2022 VMware, Inc.
All rights reserved. Visit https://spring.io/tools

This product includes software developed by the
Eclipse Foundation https://www.eclipse.org

This product includes software developed by the
Apache Software Foundation https://www.apache.org

Lombok v1.18.24 "Envious Ferret" is installed. https://projectlombok.org/

Obviously not a programming question but this audience is likely the only folks who might have seen this...anyone?

When in this wacky state, pressing keys with no editor buffer impact (e.g. shift keys, arrow keys) does nothing to change behavior but pressing a key with editor buffer impact (e.g., space bar, letters, backspace, etc.) stops the wacky behavior. So this behavior makes me lean toward a software problem instead of keyboard hardware issue.

FWIW, I don't see this wacky behavior in my desktop environment running openSUSE 15.4.

Update: Similar behavior in STS Eclipse 4.17:

Spring Tool Suite 4

Version: 4.17.0.RELEASE
Build Id: 202212060857
Revision: e5d4f36a56c66862556fb938ade6c05abce57d39

Copyright (c) 2007 - 2022 VMware, Inc.
All rights reserved. Visit https://spring.io/tools

This product includes software developed by the
Eclipse Foundation https://www.eclipse.org

This product includes software developed by the
Apache Software Foundation https://www.apache.org

Lombok v1.18.24 "Envious Ferret" is installed. https://projectlombok.org/

Update 2: Similar behavior in Eclipse IDE 2022-12:

Eclipse IDE for Java Developers (includes Incubating components)

Version: 2022-12 (4.26.0)
Build id: 20221201-1913
(c) Copyright Eclipse contributors and others 2000, 2022.  All rights reserved. Eclipse and the Eclipse logo are trademarks of the Eclipse Foundation, Inc., https://www.eclipse.org/. The Eclipse logo cannot be altered without Eclipses permission. Eclipse logos are provided for use under the Eclipse logo and trademark guidelines, https://www.eclipse.org/logotm/. Oracle and Java are trademarks or registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

This product includes software developed by other open source projects including the Apache Software Foundation, https://www.apache.org/.

Lombok v1.18.24 "Envious Ferret" is installed. https://projectlombok.org/

Update 3: Similar behavior in Eclipse SDK without Lombok:

Eclipse SDK
Version: 2022-12 (4.26)
Build id: I20221123-1800
OS: Linux, v.5.14.0-1052-oem, x86_64 / gtk 3.24.33, WebKit 2.38.2
Java vendor: Oracle Corporation
Java runtime version: 19+36-2238
Java version: 19